简体   繁体   English

Office 脚本范围内的最后一行

[英]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:例如,假设我想 select 他在 G 列中的整个范围为 VBA 公式,我会使用:

Range(Range("G2"), Range("G2").End(xlDown)) =范围(范围(“G2”),范围(“G2”)。结束(xlDown))=

For Office Scripts the closest I can come to is:对于 Office 脚本,我能找到的最接近的是:

selectedSheet.getRange("G2").copyFrom(selectedSheet.getRange("G2:G2287"), ExcelScript.RangeCopyType.values, false, false); 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我不确定这是否是您想要的,但如果您想知道 G 列中的最后一个单元格,您可以使用

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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