2

I have a Google Sheets script that automatically edits a cell in my sheet with a timed trigger, and I would like a second part of the script to run once that edit is automatically made. However, the Google Script Guides say this:

Script executions and API requests do not cause triggers to run. For example, calling FormResponse.submit() to submit a new form response does not cause the form's submit trigger to run.

Is there anyway around this? What solutions are available to me?

2 Answers 2

2

Include a call to your onEdit function from the functions that make changes to your spreadsheet.

0

If your time based trigger changes cell A1 for example, you can invoke "edit" trigger by calling onEdit function with defined e.range parameter:

// get cell
var cell = SpreadsheetApp.getActiveSheet().getRange('A1');

// change cell value
cell.setValue('changed!');

// call onEdit directly
onEdit({range: cell});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.