I've tried to realize a script but it does not run! The aim of this script is to send slide file by email automatically by clicking in the menu button. In the same time the pdf file is saved automatically. I've developed it and it runs.
I've tried to modify the script in order to scan the emails written in slide 1 and use them to send the email. I've not found the code to do that automatically (between lines 33 to 73). Could you please help me to find the solution? Very big thank you
The Folder where all the files are stored, by clicking here. The script is inside of the slide, by clicking here
A part of the script where are the errors:
// Access to 1st table
var table1 = slide1.getShapes().find(function (shape) {
return shape.getShapeType() === SlidesApp.ShapeType.TABLE;
})[0].getTable();
// Access to 2nd table
var table2 = slide1.getShapes().find(function (shape, index) {
return shape.getShapeType() === SlidesApp.ShapeType.TABLE && index > 0;
})[0].getTable();
// Recuperate data from tables 1 & 2
var data1 = table1.getCell(0, 0).getRange().getValues();
var data2 = table2.getCell(0, 0).getRange().getValues();
enter code here
enter code here
You have two problems:
Problem 1:
getShapes()returns a collection of Shapes. A Shape doesn't have agetTable()method.To get tables from a slide, call
getTables()instead:Problem 2:
getCellreturns a TableCell which doesn't have thegetRange()method.To get the cell value of the first column of the first row, call
getText()andasString()instead:Example code
With that in mind, here's a possible rewrite that collects values from the first column of the tables:
Note: The
data1anddata2variables in this example are one-dimensional arrays. So it doesn't drop in without augmenting code further down your script where it expects a two-dimensional array.