Removes values, formatting, and notes from a range.
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
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.
More Apps Script
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().
What's Better Than Google Sheets?
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →Protect Your Formulas from Accidental Deletion in Google Sheets
Ever spent hours crafting the perfect formula in Google Sheets, only to accidentally delete it? It's a frustrating experience that can derail your productivity. Fear not! In this guide, we'll unveil some clever tricks to safeguard your hard work.
Read post →Explore Coding in Google Sheets
Did you know you can actually code in Google Sheets?
Read post →