Google-sheets – Google script app delay without freezing spreadsheet calculation

google sheetsgoogle-apps-script

How can I have delay on Google Script App function without freezing the spreadsheet calculation.

sleep function freezing all spreadsheet calculation, and I have many calculation on the spreadsheet that I want to finish before the next step.

How can I solve that?

Best Answer

Use SpreadsheetApp.flush(); to apply the changes made by the script before the sleep statement.