class SpreadsheetApp method .clear()

SpreadsheetApp is the Apps Script service.

.clear() is the method name you will see after a dot in your code.

What it does

Removes values, formatting, and notes from a range.

Why it's used

  • Wipe a staging area before loading fresh data.
  • Reset a template range for the next import run.

Common errors

  • Forgetting parentheses on clear. Write SpreadsheetApp.clear(), not SpreadsheetApp.clear or clear by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').clear().
  • Adding spaces where they do not belong. Write SpreadsheetApp.clear(), not SpreadsheetApp .clear(), SpreadsheetApp.clear (), or SpreadsheetApp . clear().
  • Wrong capitalization. Use SpreadsheetApp and clear, not spreadsheetapp or clear.

Explore

Related methods

  • .clearContent()

    Removes only cell values from a range, keeping formatting.

  • .clearFormat()

    Removes only formatting from a range, keeping values.

  • .deleteSheet()

    Removes a sheet tab from the spreadsheet.

  • .flush()

    Forces pending spreadsheet changes to save immediately.

  • .activate()

    Makes a sheet or range the active selection.

Better Sheets tutorials

Scrape Google Maps

Scrape Google Maps

Scrape any query in Google Maps into your Google Sheets. Enter your API ...
Scrape Google Maps Added Phone and Reviews

Scrape Google Maps Added Phone and Reviews

Added two helper functions to get Phone numbers and reviews of the Googl...
Twitter App Clone in a Google Sheet

Twitter App Clone in a Google Sheet

I built a twitter clone in Google Sheets

Related blog posts

Written guides about SpreadsheetApp.clear().

Browse the blog