class SpreadsheetApp method .clearContent()

SpreadsheetApp is the Apps Script service.

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

What it does

Removes only cell values from a range, keeping formatting.

Why it's used

  • Empty cells but keep colors and borders intact.
  • Refresh data rows without rebuilding the whole layout.

Common errors

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

Explore

Related methods

  • .clearFormat()

    Removes only formatting from a range, keeping values.

  • .clear()

    Removes values, formatting, and notes from a range.

  • .getDisplayValues()

    Reads the formatted text shown in every cell in a range.

  • .deleteSheet()

    Removes a sheet tab from the spreadsheet.

  • .setWrap()

    Turns text wrapping on or off for cells in a range.

1 Better Sheets tutorials

Automatically Clear Content | Refresh Reuse Recycle Templates

Automatically Clear Content | Refresh Reuse Recycle Templates

Create automatic functions to clear content.

Related blog posts

Written guides about SpreadsheetApp.clearContent().

Browse the blog