The appscript works only for manual trigger

16 views Asked by At

the problem is that i set a trigger and it works well for other function except this one

How could i save this ?

Here is my function.

function myFunction() {
  console.log("Script started");

  const objectId = "g2a712e82c02_0_167";

  const spreadsheet = SpreadsheetApp.openById("1eMOB_PFHZdtLcPWXqipxXz1gNL4WH80soowxTbGvEXo");
  const hexColor = spreadsheet.getSheetByName("box_interactive_color").getRange("E2").getValue();

  const slide = SlidesApp.openById("1cqk0xsjM-EY_ymGh1UfMpjIXIEqumDyjSTZF9hpBFlY");
  const shapes = slide.getSlides()[0].getShapes();

  var obj = shapes.filter(s => s.getObjectId() == objectId);

  if (obj.length > 0) {
    obj[0].getFill().setSolidFill(hexColor);
    console.log("Shape color updated successfully");
  } else {
    console.error("Shape not found");
  }

  console.log("Script completed");
}


0

There are 0 answers