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

Sets top, middle, or bottom alignment for cells in a range.

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

Better Sheets tutorials

Automatically Align Top

Automatically Align Top

Automate formatting cells to align top. Either by a time-based trigger o...

Related blog posts

Written guides about SpreadsheetApp.setVerticalAlignment().

Browse the blog