Sets how numbers and dates display in a range.
class SpreadsheetApp method .setNumberFormat()
SpreadsheetApp is the Apps Script service.
.setNumberFormat() is the method name you will see after a dot in your code.
What it does
Why it's used
- Force currency or percent display on calculated columns.
- Make exported reports look right without manual formatting.
Common errors
- Forgetting parentheses on setNumberFormat. Write SpreadsheetApp.setNumberFormat(), not SpreadsheetApp.setNumberFormat or setNumberFormat by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').setNumberFormat().
- Adding spaces where they do not belong. Write SpreadsheetApp.setNumberFormat(), not SpreadsheetApp .setNumberFormat(), SpreadsheetApp.setNumberFormat (), or SpreadsheetApp . setNumberFormat().
- Wrong capitalization. Use SpreadsheetApp and setNumberFormat, not spreadsheetapp or setnumberformat.
Explore
Related methods
-
.clearFormat()
Removes only formatting from a range, keeping values.
-
.setWrap()
Turns text wrapping on or off for cells in a range.
-
.clear()
Removes values, formatting, and notes from a range.
-
.setFontColor()
Sets the text color of cells in a range.
-
.getNumRows()
Returns how many rows are in a range.
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.setNumberFormat().
Every Locale Listed in Google Sheets and a Tool to Save Your Sanity
If you live in a country that is not well represented with blog posts or someone makes a blog post about a Google Sheets issue, they create a Google Sheet formula and then you copy and paste it into your sheet and it has the wrong delimiter. How do you resolve that?
Read post →Getting Started in Google Sheets Spreadsheet Management
Users can also customize the appearance of their spreadsheets with different fonts, colors, and themes.
Read post →How to Use Google Sheets as a Website Database
Did you know you can use Google Apps Script to turn a Google Sheet into a free, auto-syncing database for your website? This guide shows you exactly how to set it up. You’ll prepare your spreadsheet, write a few lines of code and publish your site. Don’t worry if you’re not a developer, we’ll walk you through it. Why Use Google Sheets as a Database? For small projects, Google Sheets offers many advantages over traditional databases: * Free hosting and storage * Easy to edit data without...
Read post →