【发布时间】:2021-09-18 07:50:12
【问题描述】:
我有一张 100 多行的 google 表格,其中的列是“NAME、PLACE、PHONE”。我想更改/更正侧栏中特定人员 Ex.John 的电话号码(Form.html)以及要在我的谷歌表“电话列表”的特定行中编辑的正确位置和电话号码。下面给出的 code.gs 不起作用。你能租用纠正一下吗?
function sidebar() {
var html = HtmlService.createHtmlOutputFromFile("Form").setTitle('Phone Details');
SpreadsheetApp.getUi().sidebar(html);
}
function result(form) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var ws = ss.getSheetByName("Phonelist");
var data = ws.getDataRange().getValues();
var name = form.name;
var place = form.place;
var phone = form.phone;
for (var i = 1; i < data.length; i++) {
if(data[i][1] == "John"){
var result = [name,place,phone];
ws.getRange(dat[i]).setValue(result);
}
}
}
【问题讨论】:
-
你能分享一个简化的电子表格吗?
标签: arrays google-apps-script google-sheets google-sheets-formula