I´m tying to get the color and the text value from a Google slides shape. The shape is a google drawing created shape. First, I used below code to set this shape color using a color that I have into a Spreadsheet. The function run perfect. I do the same with the text of shape and I haven´t got any problem. But when I try to get the color and text from a shape into google slides to copy in a spreadsheet not work...
This is the function to set color of a shape using the objectid :
function setColor() {
const objectId = "g11262e0cb1e_0_256";
const hexColor = SpreadsheetApp.openById(ssurl).getSheetByName("data")
.getRange("D1").getValue();
const slide = SlidesApp.openById(slideurl).getSlides()[0];
var obj = slide.getShapes().filter(s => s.getObjectId() == objectId);
if (obj.length > 0) obj[0].getFill().setSolidFill(hexColor,1);
}
This is the function to get color of a shape using the objectid :
function getColor() {
const objectId = "g11262e0cb1e_0_256";
const slide = SlidesApp.openById(slideurl).getSlides()[0];
var obj = slide.getShapes().filter(s => s.getObjectId() == objectId);
if (obj.length > 0) obj[0].getFill().getSolidFill();
//console.log(obj);
SpreadsheetApp.openById(ssurl).getSheetByName("data")
.getRange("I1").setValue(obj);
}