google spreedsheet脚本停止使用属性对象

时间:2017-03-24 12:45:42

标签: google-apps-script

我半年前找到了一个脚本,它将Google桌面上的数据卸载到trello中。我经常使用它。

今天,它停止了“数据仓库错误”错误。 该脚本发誓要使用脚本的属性:

function checkControlValues(requireList, requireBoard) {
  var col = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Настройка трелло").getRange("B3:B6").getValues();

  var documentProperties = PropertiesService.getDocumentProperties();
  var scriptProperties = PropertiesService.getScriptProperties();
  var userProperties = PropertiesService.getUserProperties();

  var appKey = col[0][0].toString().trim();
  if(appKey == "") {
    return "App Key not found";
  }  
  scriptProperties.setProperty("appKey", appKey);

特别是在行“scriptProperties.setProperty(”appKey“,appKey);” 即使您写,也会发生错误 scriptProperties.setProperty(“appKey”,“123123”);

Here is the log of the script:
[17-03-24 15: 35: 21: 837 EAT] Running ...
[17-03-24 15: 35: 21: 846 EAT] SpreadsheetApp.getActiveSpreadsheet () [0 seconds]
[17-03-24 15: 35: 21: 942 EAT] Spreadsheet.getSheetByName ([Thrallo Setting]) [0.095 sec.]
[17-03-24 15: 35: 22: 005 EAT] Sheet.getRange ([B3: B6]) [0.063 seconds]
[17-03-24 15: 35: 22: 061 EAT] Range.getValues ​​() [0,055 seconds]
[17-03-24 15: 35: 22: 143 EAT] PropertiesService.getDocumentProperties () [0.08 seconds]
[17-03-24 15: 35: 22: 144 EAT] PropertiesService.getScriptProperties () [0 seconds]
[17-03-24 15: 35: 22: 145 EAT] PropertiesService.getUserProperties () [0 seconds]
[17-03-24 15: 35: 25: 913 EAT] Properties.setProperty ([appKey, XXXXXXXX]) [3,768 seconds]
[17-03-24 15: 35: 25: 924 EAT] Can not complete the completion in 4,069 seconds. Data warehouse error (line 268, export evaluation file for programming in a trello)

我将补充说,该脚本在Google桌面堆中立即停止工作,之前使用过它。

怎么办?

我将补充说,即使在Google文档中复制的代码(https://developers.google.com/apps-script/guides/properties)上也会出现错误

存储属性的每一行都会产生相同的错误

// Set a property in each of the three property stores.
var scriptProperties = PropertiesService.getScriptProperties();
var userProperties = PropertiesService.getUserProperties();
var documentProperties = PropertiesService.getDocumentProperties();

scriptProperties.setProperty('SERVER_URL', 'http://www.example.com/');
userProperties.setProperty('DISPLAY_UNITS', 'metric');
documentProperties.setProperty('SOURCE_DATA_ID', '1234567890abcdefghijklmnopqrstuvwxyz');
To save data in bulk, pass a map of key-value pairs to Properties.setProperties(properties). Each key-value pair of the object in the parameter is stored as a separate property:

// Set multiple script properties in one call.
var scriptProperties = PropertiesService.getScriptProperties();
scriptProperties.setProperties({
  'cow': 'moo',
  'sheep': 'baa',
  'chicken': 'cluck'
});

1 个答案:

答案 0 :(得分:0)

对我来说同样的问题。使用PropertiesService.getDocumentProperties更改PropertiesService.getScriptProperties已经适用于我的情况。