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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
goose
  • 2,502
  • 6
  • 42
  • 69
  • 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. https://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. – David Tew Feb 07 '18 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. – goose Feb 07 '18 at 20:15
  • 1
    Similar question here: https://stackoverflow.com/questions/45280944/updating-linked-table-in-google-slides-api - there's a feature request https://issuetracker.google.com/issues/64027131 , status 'assigned' at the moment so there's hope... – Leo Oct 30 '18 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. – Aleister Tanek Javas Mraz Jan 24 '20 at 15:02

5 Answers5

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

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 ad...@lovecrafts.com

Jescanellas
  • 2,555
  • 2
  • 9
  • 20
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?

user3347814
  • 1,138
  • 9
  • 28
  • 50
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()

Yash
  • 61
  • 2
-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.

Cinder Biscuits
  • 4,880
  • 31
  • 51