Home > Software engineering >  Not able to clear the content of a cell
Not able to clear the content of a cell

Time:03-06

I want to set a value to cell X58 as then wait for 10 seconds and delete the cell value.

Issue = only value is getting set..

Here is the part of my code

function a(){
 var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Course');
    spreadsheet.getRange('X58').setValue('Hooray! Event is added to your calendar');
    SpreadsheetApp.flush();
    Utilities.sleep(10000);
    spreadsheet.getRange('X58').clearContent;
  }
}

Pls help.

CodePudding user response:

clearContent should be clearContent()

And you have one too many brackets in your code

function a() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet0');
  spreadsheet.getRange('A1').setValue('Hooray! Event is added to your calendar');
  SpreadsheetApp.flush();
  Utilities.sleep(10000);
  spreadsheet.getRange('A1').clearContent();
}

This works

  • Related