Reputation: 29
I've got a script that emails the google sheets on a monthly basis. And that works fine.
Recurring option runs a script and then emails the spreadsheet. The problem I've got is that it emails last opened spreadsheet rather than the updated version of it. And I'm not sure how to update the sheet and only then send it.
How can I make sure that the spreadsheet gets updated just before the email is sent?
I'm opening spreadsheet with ".openById" and it does get updated, but only after email is sent.
Sending email function is added at the end of the script that changes the spreadsheet.
Please help,
Upvotes: 0
Views: 87
Reputation: 27242
You may want to check out the .flush() method : it applies all pending Spreadsheet changes.
Upvotes: 1