Google Sheets Script - Reset Button Clear cells in multiple sheets

837 views
Skip to first unread message

Jess K

unread,
Aug 8, 2022, 9:33:55 PM8/8/22
to Google Apps Script Community
Hi,

I found a form with info on creating reset buttons. Alex Ivanov offered a script for clearing cells in multiple worksheets,  but I'm trying to use it and it's not working. Can anyone help?

This is what I need cleared:
Sheet 1 B7:D100
Sheet 2 Column H through K

This is the script Alex originally posted. 

function onOpen() {
  SpreadsheetApp.getUi()
  .createMenu('Reset sheet')
  .addItem('Based on a permanent ranges address list', 'userActionResetByRangesAddresses')
  .addToUi();
}
function userActionResetByRangesAddresses(){
  var sheet = SpreadsheetApp.getActiveSheet();
  var rangesAddressesList = ['B5', 'B7', 'B9', 'B11', 'B15', 'B19'];
  resetByRangesList_(sheet, rangesAddressesList);
}
function resetByRangesList_(sheet, rangesAddressesList){
  sheet.getRangeList(rangesAddressesList).clearContent();
}

I tried it and changed the values, but kept getting an error when running it.

Let me know if you can help.

Thanks,

Jess

Tanaike

unread,
Aug 10, 2022, 2:24:33 AM8/10/22
to Google Apps Script Community

game over

unread,
Feb 19, 2023, 3:58:44 PM2/19/23
to Google Apps Script Community
Reply all
Reply to author
Forward
0 new messages