In a script I'm setting a range using a Named Range. I need to get the first row number, to use for setting vals in other cols.
The Named Range 'ASX_100' is Top5!A 8 :A107... so the first Row Number I need is 8, but as a script novice I can't find something online to help. My code so far:
const ui = SpreadsheetApp.getUi();
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sTop5 = ss.getSheetByName('Top5');
const rASX100 = ss.getRange('ASX_100'), iLen = rASX100.getNumRows();
// Get first sheet row number in range rASX100:
How should I go about this pls?
Once you have the range ( rASX100
), you can get its first row with the methods getRow() or getRowIndex() :
const ui = SpreadsheetApp.getUi();
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sTop5 = ss.getSheetByName('Top5');
const rASX100 = ss.getRange('ASX_100'), iLen = rASX100.getNumRows();
// Get first sheet row number in range rASX100:
const firstRangeRow = rASX100.getRow();
For the last row, you can use getLastRow() .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.