I want to auto-update the linked objects in google slides (charts and tables). I saw answers from previous questions and assembled the code below :
function onOpen() {
SlidesApp.getUi() // Or DocumentApp or FormApp.
.createMenu('Update Charts')
.addItem("Update now", 'refreshCharts').addToUi();
refreshCharts();
}
function refreshCharts(){
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();
}
}
}
It updates the charts when i go click on Update Charts> Update now
. But it does not, first of all, update the chart on Opening the slides. And also another issue, it only works with charts right now, is there a way to include tables too in the script, so all charts and table can be updated?
Update to the question
Is there may be a way to directly link a button directly to the Update all button in Tools>Linked objects>Update All
Is it possible to have a button on the slides to directly do this?