Untitled
unknown
javascript
a year ago
1.0 kB
4
Indexable
function runUpdateFunctions() { var range = 'A1:D4' updateSlidesTableFromSheets('A1:D4', 0) updateSlidesTableFromSheets('A7:D10', 1) } function updateSlidesTableFromSheets(range, table_num) { var sheetName = 'Sheet 1'; // The name of the sheet tab you want to sync // Access the source data from Google Sheets var sheet = SpreadsheetApp.openById(sheetId).getSheetByName(sheetName); var values = sheet.getRange(range).getDisplayValues(); // Access the target Google Slide and the table within it var slides = SlidesApp.openById(slideId); var slide = slides.getSlides()[1]; // Assuming you want to update the first slide; adjust as necessary var table = slide.getTables()[table_num]; // Assuming you want to update the first table; adjust as necessary // Update the table in Google Slides with the data from Sheets for (var i = 0; i < values.length; i++) { for (var j = 0; j < values[i].length; j++) { table.getCell(i, j).getText().setText(values[i][j].toString()); } } }
Editor is loading...
Leave a Comment