我为Google表格编写了一个简单的脚本,以将条目及其时间戳记起来。现在,每个条目都要花几秒钟的时间才能注册,我想加快速度。有没有简单的方法可以通过替换一些步骤来做到这一点?我也希望能够在飞机模式下完成这项工作。使用当前的脚本,如果我处于离线状态,它将停止工作,直到退出飞行模式。在某处是否有一个简单的选项可以在飞行模式下输入数据?以下是代码。通过按下单元格A1中的按钮来激活代码,投票计数显示在单元格B1中,并且在单元格C1中具有时间戳功能“ = now()”
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B1");//this is the cell with the current ballot count
var ballot = cell.getValue();// read current ballot count
var timestamp = sheet.getRange('C1').getValue();//read timestamp from cell with formula =now()
sheet.insertRowAfter(2);//add record after separation row, on row 3
cell.setValue(ballot + 1);//
sheet.getRange('a3').setValue(ballot);
sheet.getRange('b3').setValue(timestamp);
}
任何想法都会受到赞赏。