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

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about SpreadsheetApp.clear().

Browse the blog