class SpreadsheetApp method .offset()

SpreadsheetApp is the Apps Script service.

.offset() is the method name you will see after a dot in your code.

What it does

Returns a range shifted by a number of rows and columns.

Why it's used

  • Move one cell over to grab the value next to a label.
  • Slide a range down a row for week-over-week comparisons.

Common errors

  • Forgetting parentheses on offset. Write SpreadsheetApp.offset(), not SpreadsheetApp.offset or offset by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').offset().
  • Adding spaces where they do not belong. Write SpreadsheetApp.offset(), not SpreadsheetApp .offset(), SpreadsheetApp.offset (), or SpreadsheetApp . offset().
  • Wrong capitalization. Use SpreadsheetApp and offset, not spreadsheetapp or offset.

Explore

Related methods

  • .getRow()

    Returns the starting row index of a range.

  • .getRange()

    Returns a range of cells by A1 notation or row and column numbers.

  • .getColumn()

    Returns the starting column index of a range.

  • .getNumRows()

    Returns how many rows are in a range.

  • .setValues()

    Writes a 2D array of values into a range of cells.

2 Better Sheets tutorials

2 New Ways To Add Emoji Reactions

2 New Ways To Add Emoji Reactions

 Revolutionize the way you react with emojis! Discover two new methods t...
Add A Timestamp to Task Lists (without Now Formula)

Add A Timestamp to Task Lists (without Now Formula)

How to add a timestamp to done tasks. Learn how to easily add timestamps...

Related blog posts

Written guides about SpreadsheetApp.offset().

Browse the blog