Sets top, middle, or bottom alignment for cells in a range.
class SpreadsheetApp method .setVerticalAlignment()
SpreadsheetApp is the Apps Script service.
.setVerticalAlignment() is the method name you will see after a dot in your code.
What it does
Why it's used
- Top-align tall rows with wrapped text.
- Polish dashboard layouts built from script.
Common errors
- Forgetting parentheses on setVerticalAlignment. Write SpreadsheetApp.setVerticalAlignment(), not SpreadsheetApp.setVerticalAlignment or setVerticalAlignment by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').setVerticalAlignment().
- Adding spaces where they do not belong. Write SpreadsheetApp.setVerticalAlignment(), not SpreadsheetApp .setVerticalAlignment(), SpreadsheetApp.setVerticalAlignment (), or SpreadsheetApp . setVerticalAlignment().
- Wrong capitalization. Use SpreadsheetApp and setVerticalAlignment, not spreadsheetapp or setverticalalignment.
Snippets using this method
Explore
Related methods
-
.setHorizontalAlignment()
Sets left, center, or right alignment for cells in a range.
-
.setWrap()
Turns text wrapping on or off for cells in a range.
-
.setBackground()
Sets the background color of cells in a range.
-
.activate()
Makes a sheet or range the active selection.
-
.setValues()
Writes a 2D array of values into a range of cells.
More Apps Script
Better Sheets tutorials
Automatically Align Top
Related blog posts
Written guides about SpreadsheetApp.setVerticalAlignment().
How to Change Border Colors in Google Sheets with Apps Script
Recolor only the borders you already have in Google Sheets, with a hex code prompt, a reset button, and a custom menu. The real Apps Script from Big Year Premium, explained step by step.
Read post →Spreadsheets Explained over 5 Levels of Difficulty
Master Google Sheets from simple text input to complex operations with our FREE tutorials, templates, and tools! Unleash the full power of spreadsheets now!
Read post →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 →