3

This question here has as succinct solution for updating Google Sheets charts linked to Google slides.

function onOpen() {
  var ui = SlidesApp.getUi();
  ui.createMenu('Custom Menu')
  .addItem('Batch Update Charts', 'batchUpdate')
  .addToUi();
}

function batchUpdate(){

  var gotSlides = SlidesApp.getActivePresentation().getSlides();

  for (var i = 0; i < gotSlides.length; i++) {
    var slide = gotSlides[i];
    var sheetsCharts = slide.getSheetsCharts();
    for (var k = 0; k < sheetsCharts.length; k++) {
      var shChart = sheetsCharts[k];
      shChart.refresh();
    }
  }
}

I wish to do the same thing but with a table pasted into Google Slides from Google Sheets. I can't see how this would look in the AppScript API for Google Slides. Can someone point out a way forward?

4
  • Not having done this, I looked for a similar .refresh() for the table entity, but I could not find one either. If indeed there isn't one then I personally would attempt to use google apps script to getValues() from the spreadsheet and then use the Slides API via script i.e. developers.google.com/apps-script/advanced/slides , writing a script to loop through the table on the slide and insert the requisite ss value per cell. Not easy but not hard, if there are no 'gotchas'. YMMV. Commented Feb 7, 2018 at 20:12
  • Thanks for the suggestion @DavidTew - I've not used appscript with slides before (I'm used to using it with sheets) I'll give it a go. Commented Feb 7, 2018 at 20:15
  • 1
    Similar question here: stackoverflow.com/questions/45280944/… - there's a feature request issuetracker.google.com/issues/64027131 , status 'assigned' at the moment so there's hope... Commented Oct 30, 2018 at 18:54
  • Hey, I recognize that code :) Someone commented on my script in OP's linked post, and that person asked if it would be possible to similarly update embedded Tables in Slides. I did a quick GSearch and found this ! Looks like we're still in "assigned" after 20 months. Commented Jan 24, 2020 at 15:02

5 Answers 5

1

Latest update: There is now an option in Slides's Tools drop-down menu to see all Linked Objects; the menu that appears has the option at the bottom to "Update all".

enter image description here enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

I found this workaround in the issuetracker link provided by Leo as a comment to OP on Oct 30 '18:

"If anyone is reading this who wants the feature, one solution is to create a "table chart" in your sheet, from your existing table (that you were trying to link/update). It doesn't allow you to copy and paste from Sheets to Slides, but within Slides if you go to Insert -> Chart -> From Spreadsheet, then choose your sheet and chart (table). You can then use app scripts to automatically update it, as you can with a chart."

From [email protected]

Comments

0

As pointed, it is not possible to do it using Google App Script, but I found a workaround using Python and Selenium, with can be ran online with Google Colab.

Is is possible to use Selenium to click on a button in a Google Slides Presentation?

Comments

0

I could not find the refresh function for table object the same way it has for sheetsChart. The script does identify PageElement as Table so it has to be in table reference.

https://developers.google.com/apps-script/reference/slides/table

https://developers.google.com/apps-script/reference/slides/sheets-chart#refresh()

Comments

-1

First you can use a similar variable as

var sheetsTables = slide.getTables() 

and then use a for() loop to update each table in each slide. However, I don´t know which method you can use. If you know of one, please share.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.