简体   繁体   中英

Office Scripts last row in range

I am having trouble finding how to make this conversion. For example, say I wanted to select he whole range in column G for a VBA formula, I would use:

Range(Range("G2"), Range("G2").End(xlDown)) =

For Office Scripts the closest I can come to is:

selectedSheet.getRange("G2").copyFrom(selectedSheet.getRange("G2:G2287"), ExcelScript.RangeCopyType.values, false, false);

Any simple ideas?

i'm not sure if this is the thing you wanted but if you want to know the last cell in the column G you could use

let range = selectedSheet.getRange();
let col = range.getColumn(6).getLastCell().getAddress();
console.log(col);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM