In this post, I will show you How to Auto Update Google Slides from Google Sheets using Google Apps Script.
To Be honest, Directly It’s Not Possible. But I have one idea to Auto Update Google Slides from Google Sheets
After, Creating a Google sheet, Create a Table chart in Google sheets with the data. For creating a Chart click on chart icon in the menu of sheet
In the chart menu, We have to select a table chart
After that, We have to select the data range in the chart from the sheet. I select range A to B because of My data in Colum A and in Column B.
after That chart is created and the sheet looks like below. You can adjust its width and height and also hide the chart.
Copy the chart. double click on the chart there is three dots and copy the chart.
Create a Google Slide and paste the copied chart. we do all these things to Auto Update Google Slides from Google Sheets
Google Slides will look like this
Open the script editor is google slides
function onOpen() {
SlidesApp.getUi() // Or DocumentApp or FormApp.
.createMenu('Update Charts')
.addItem("Update now !!!!!", 'refreshCharts')
.addSeparator()
.addItem('Create Trigger', 'createTrigger')
.addToUi();
}
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();
}
}
}
function createTrigger() {
// Trigger every 1 minute
ScriptApp.newTrigger('refreshCharts')
.timeBased()
.everyMinutes(1)
.create();
}
finally, we can Auto Update Google Slides from Google Sheets