【发布时间】:2019-09-27 11:42:41
【问题描述】:
我正在尝试编写一个脚本,该脚本将添加一个新行,其中包含一个引用该新行中单元格的公式。在新行中,A 列将是我开始的时间,B 列是我完成的时间,C 列将是 B - A 给出持续时间。我认为对于大多数阅读本文的人来说这应该是相当简单的,但是我看过的所有帖子都试图实现更复杂的结果,而我对此并不陌生。这是我的“伪代码”:
function newRow() {
var spreadsheet = SpreadsheetApp.getActive();
var row1 = spreadsheet.getActiveCell().getRow(); // Gets the current row number
spreadsheet.appendRow(['00:00:00','00:00:00', "=B(row1+1)-A(row1+1)" ]); // add the new row, filling column A & B with time place holders, then in column C calculate the difference between A & B of this new row.
}
任何答案、帮助、指导或参考以前曾问过这个问题(我只是找不到),我们将不胜感激。
【问题讨论】:
标签: google-apps-script google-sheets google-sheets-api google-sheets-formula