![](/img/trans.png)
[英]how to sort 1000 of rows of html table using jquery or javascript fast
[英]How to get the last 1000 rows dynamically and sort them using GAS?
我试图让它动态地只对最后 1000 行进行排序。 这是我正在使用的代码:
function sort(e){
const formRespSheet = e.source.getSheetByName('Form Responses 1');
let lr = formRespSheet.getLastRow()-1;
let firstRow = 2
if (lr > 1000) {
firstRow = lr - 1000;
}
Logger.log('First Row: ' + firstRow)
Logger.log('Last Row: ' + lr)
formRespSheet.getRange(firstRow, 1, lr, 16).sort(14);
}
它给了我正确的firstRow
和lr
,但它也抛出The coordinates of the range are outside the dimensions of the sheet
,除了永远运行(15 秒)。
谁能帮我找到这里的缺陷(除了我自己)?
谢谢!
getRange 的签名使用numRows
和numColumns
,而不是lastRow
和lastColumn
。
因为您从第 2 行开始选择,所以它会尝试获得超出电子表格范围的范围。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.