在App maker脚本上返回Null,以将GS导入模型

时间:2019-01-12 09:20:24

标签: google-app-maker

每次运行应用程序时,都在下面找到了脚本(感谢此操作)以刷新Google表格中的模型数据,但由于某种原因用空值写入了新记录。值以预期的开始显示,因此不确定哪里出了错

function getSSData(){
var file_id = '1gLHP0CuvwziIYOzvhDkX2m*********';
var values = SpreadsheetApp.openById(file_id).getSheets() 
[0].getDataRange().getValues();
console.log("values is  " + values);
var ssData = [];
console.log("ssdata is  " + ssData);
for (var i = 0; i<values.length; i++){
console.log("value i is  " + i);
var newRecord = app.models.customer_details.newRecord();
console.log("newrecord is  " + newRecord);
// add all fields to the new record
newRecord.MODEL_FIELD = values[i][0];
ssData.push(newRecord);
}
// return the array of the model.newRecord objects that would 
be consumed by the Model query.

console.log("ssdata is  " + ssData);
return ssData;
}

我得到日志

  

值是时间戳记,电子邮件地址,名称,电话,地址行1,地址行2,镇,县,邮政编码,星期五2019年1月11日星期五格林尼治标准时间0000(GMT),bbe @ live.co。 uk,bob lot,0788 346723,1 the road ,, Fareham,Hants,po18 34r,Fri Jan 11 2019 16:41:26 GMT-0000(GMT),test @ test.com,tom tom,56377721,2 the road ,路2,伦敦,伦敦,SW1 34R   08:56:39.825 com.google.apps.appmaker.AppMakerGwt-0.js:7330 ssdata是
  08:56:39.826 com.google.apps.appmaker.AppMakerGwt-0.js:7330值i为0   08:56:39.828 com.google.apps.appmaker.AppMakerGwt-0.js:7330 newrecord是Record:{ID:null,Timestamp:null,Email_address:null,Name:null,Phone:null,Address_line_1:null,Address_line_2 :null,城镇:null,县:null,邮政编码:null}   08:56:39.829 com.google.apps.appmaker.AppMakerGwt-0.js:7330值i为1   08:56:39.830 com.google.apps.appmaker.AppMakerGwt-0.js:7330 newrecord是Record:{ID:null,Timestamp:null,Email_address:null,Name:null,Phone:null,Address_line_1:null,Address_line_2 :null,城镇:null,县:null,邮政编码:null}   08:56:39.832 com.google.apps.appmaker.AppMakerGwt-0.js:7330值我是2   08:56:39.832 com.google.apps.appmaker.AppMakerGwt-0.js:7330 newrecord是Record:{ID:null,Timestamp:null,Email_address:null,名称:null,电话:null,Address_line_1:null,Address_line_2 :null,城镇:null,县:null,邮政编码:null}   08:56:39.833 com.google.apps.appmaker.AppMakerGwt-0.js:7330 ssdata是Record:{ID:null,Timestamp:null,Email_address:null,Name:null,Phone:null,Address_line_1:null,Address_line_2 :空,镇:空,县:空,邮政编码:空},记录:{ID:空,时间戳:空,电子邮件地址:空,姓名:空,电话:空,地址行_1:空,地址行_2:空,镇:空,县:null,邮政编码:null},记录:{ID:null,时间戳:null,电子邮件地址:null,名称:null,电话:null,地址行_1:null,地址行2:null,城镇:null,县名:null,邮政编码:null}

0 个答案:

没有答案