Removes only cell values from a range, keeping formatting.
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
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.
Snippets using this method
- Ultimate Prompt Writer and Prompt Rater
- Visicalc 2023 Design Walkthrough
- Visicalc 2023 Quick Walkthrough
- How To Format Sheets for Notes
- Expense Tracker Template with Data Entry Form Inside Sheets
- How to Create AI Images From Google Sheets
- Daily Writer's Word Count Tracker
- Fast FAQS
- ChatGPT Clone in Google Sheets Part 2
- ChatGPT Clone in Google Sheets Part 1
- Automatically Clear Content | Refresh Reuse Recycle Templates
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.
More Apps Script
Better Sheets tutorials
Automatically Clear Content | Refresh Reuse Recycle Templates
ChatGPT Clone in Google Sheets Part 1
ChatGPT Clone in Google Sheets Part 2
Daily Writer's Word Count Tracker
Expense Tracker Template with Data Entry Form Inside Sheets
Fast FAQS
How to Create AI Images From Google Sheets
How To Format Sheets for Notes
Ultimate Prompt Writer and Prompt Rater
Visicalc 2023 Design Walkthrough
Related blog posts
Written guides about SpreadsheetApp.clearContent().
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 →Transform Your Spreadsheets with OpenAI API and Apps Script
Turn your spreadsheets into AI machines of epic-ness. Transform your sheets, your writing, your life into an amazing tool you'll never stop using, and producing with. I think you'll be able to 10x or 100x your output. This course is great for writers, businesses, agencies.
Read post →