【发布时间】:2020-07-14 09:43:36
【问题描述】:
我附上了一些尝试执行此操作的代码,但我很难将数组返回到工作表。数据格式如下。 [1]:https://i.stack.imgur.com/6H6jF.png 对于其他列,只需调用 SpreadsheetApp.getActiveSpreadsheet().sort(#); 但是,有了这个,基本上我想保持列表的顺序,除了第四列中带有“Seen”的任何值都放在最后。我尝试过:
function sortProgress() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var output = [];
var i = 0;
while (sheet[i] != null) {
if (sheet[i][4] != "Seen") {
output.push(sheet[i]);
}
i++;
}
i = 0;
while (sheet[i] != null) {
if (sheet[i][4] == "Seen") {
output.push(sheet[i]);
}
i++;
}
sheet.getRange("A1:A20").setValues(output);
}
但我不知道如何将其实际显示到 Google 电子表格中。任何提示将不胜感激。
【问题讨论】:
标签: google-apps-script google-sheets