How do I create an Auto-Clear Script in a Google Spreadsheet?

后端 未结 2 1856
遥遥无期
遥遥无期 2020-12-29 16:00

I could use some help with writing a script in my Google spreadsheet. First off, I am no programmer and a novice at best on writing code or any script.

I want to

2条回答
  •  猫巷女王i
    2020-12-29 16:55

    Follow these steps...

    01. Go to https://script.google.com and then add a New Script.

    ᴬᵈᵈ ⁿᵉʷ ˢᶜʳⁱᵖᵗ

    02. Paste this function

    function clearRange() {
          // replace 'Sheet1' with your actual sheet name
          // replace 'dhrhrejYOURSHETIDerhe5j54j5j' with your actual sheet ID
    
          var sheetActive = SpreadsheetApp.openById("dhrhrejYOURSHETIDerhe5j54j5j").getSheetByName("Sheet1");
          sheetActive.getRange('A:Y').clearContent();
    
        }
    

    ˢᵖʳᵉᵃᵈˢʰᵉᵉᵗ ᴵᴰ ᴱˣᵃᵐᵖˡᵉ

    03. Goto Run & select Run function and then select clearRange.
    Once you have run the script, your spreadsheet should be cleared.  

    Follow these steps if it works correctly...

    04. Goto Edit, Select 'All your triggers'

    05. In 'All your triggers' popup windows, select clearRange as the Run function.
    06. Set the time as you like. (See the example image)

提交回复
热议问题