1
我使用getRowsData
來檢索信息,但我想修改存儲在JS對象中的值,然後將修改後的值寫回到單元格中。我想用getRowsData
創建的規範化標題變量寫回到單元格中。所以,如果我retrive使用修改JavaScript對象並使用setRowsData寫入單個單元格
var thirdEmployee = employeeObjects[2];
var stringToDisplay = "The third column is: " + thirdEmployee.firstName + " " + thirdEmployee.lastName;
stringToDisplay += " (id #" + thirdEmployee.employeeId + ") working in the ";
stringToDisplay += thirdEmployee.department + " department and with phone number ";
stringToDisplay += thirdEmployee.phoneNumber;
ss.msgBox(stringToDisplay);
然後信息,例如,我會分配一個新值Javascript對象thirdEmployee.phoneNumber;
,然後把它寫入正確的位置範圍內(即,活動行,列#基於標題)。
thirdEmployee.phoneNumber = "123-555-5555";
thirdEmployee.phoneNumber.setNewValue();
or
setNewValue.thirdEmployee.phoneNumber;
基本上,這將是setRowsData
的修改版本,但是允許一個對象的修改,然後告知對象要被寫入到基於活性物質的行基於報頭&列中的電子表格。
任何人使用或知道如何做到這一點?
谷歌的Apps腳本將讓你寫的主動行/列。應該有辦法用GAS做到這一點。 JavaScript客戶端? – eddyparkinson
是的,我只是使用菜單運行功能。 – user2041458
我看到您正在使用「擴展Google表格」教程。它有一個「寫數據」的部分,你嘗試過嗎?它看起來應該做你所問的。 (教程https://developers.google.com/apps-script/guides/sheets#writing)你有很多數據,太多太慢了,因爲它有optFirstDataRowIndex來加快速度。 – eddyparkinson