I have some script in my Google Sheets/ It can take a lot of time to finish all this script (up to 5 minutes I think). And I want to show some message that user should just wait a little. So I have some code like:
function test(){
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var cell = sheet.getRange("A1");
sheet.clear();
cell.setValue('WAIT!!!!');
DATA = UrlFetchApp.fetch(url);
// And some action that takes a lot of time ....
cell.setValue('DONE!!!!');
But it doesn't show "WAIT" it only shows me "DONE" when everything is ok. It can only show me "WAIT" if there was any error and function crashed. It looks like I need to refresh it somehow.
Call the flush()method after you set the cell value to wait.
SpreadsheetApp.flush(); //Applies all pending Spreadsheet changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With