yumba
yumba

Reputation: 1106

getNextDataCell - Direction not defined

I'm trying to replicate the example for getNextDataCell() per the official documentation inside the Google Script Editor.

// Assume the active spreadsheet is blank.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];

var range = sheet.getRange("C3:E5");
// Logs "C1"
Logger.log(range.getNextDataCell(Direction.UP).getA1Notation());

However, I get: ReferenceError: Direction is not defined (line 8).

I don't understand why I should be defining Direction? Isn't that a built-in parameter?

Upvotes: 0

Views: 558

Answers (1)

Mateo Randwolf
Mateo Randwolf

Reputation: 2930

Solution

Change Direction.UP for SpreadsheetApp.Direction.UP

Direction is part of the class SpreadsheetApp.

I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

Upvotes: 2

Related Questions