小编Emi*_*ile的帖子

如何为 Google Apps 脚本网络应用程序上的并发用户提供便利?

我目前正在创建一个可以读取和写入 Google 表格的网络应用程序。它本质上是一个表单应用程序,它从 HTML 表单获取输入,使用appendRow()(以及后续使用getRange()并将setValue()更多数据附加到该行)将其写入工作表。每行代表正在填写的表单的一个实例。请参阅写入过程的示例代码。

/*
Function that is called in Index.html whenever the 'Next' button pressed. This 
gets all inputs from HTML form and stores them in the spreadsheet.

Parameters:
inputArray: a 1x3 array which contains the owner, reference and type of scale.
*/

function addProjectInputs(inputArray) {
  var sheetName = "Inputs";
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = spreadsheet.getSheetByName(sheetName);
  Logger.log(sheet);
  var d = new Date();
  var tz = spreadsheet.getSpreadsheetTimeZone();
  var d = [Utilities.formatDate(d,tz, …
Run Code Online (Sandbox Code Playgroud)

concurrency locking google-sheets google-apps-script

5
推荐指数
1
解决办法
1966
查看次数