Reputation: 31
I can't find an option that could look like
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getActiveSheet();
sheet.getRange(sheet.getCurrentCell() + 1,1).getValue())
Upvotes: 3
Views: 3583
Reputation: 5953
Based on my understanding, you want to get the value of the cell below the current cell (+1 row of the current cell).
You can modify your current code like this:
sheet.getRange(sheet.getCurrentCell().getRow() + 1,1).getValue()
You need to get the row index of the current cell first using Range.getRow(), then increment it by 1.
You can use Range.offset(rowOffset, columnOffset) to go into the next row then get its value using Range.getValue()
Sample Sheet:
Sample Code:
function myFunction(){
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getActiveSheet()
Logger.log(sheet.getCurrentCell().offset(1,0).getValue());
}
Output:
Upvotes: 2