[英]Google Web App Script Daily Update for Cell
Hello in my below link i have a user form were i can add, edit and delete a user.您好,在下面的链接中,我有一个用户表单,我可以添加、编辑和删除用户。
Spreadsheet Link https://docs.google.com/spreadsheets/d/1tyz_3WeEkmY4WX8Xvx38nkLow8hcbCjPMLS1-NiPFgo/edit?usp=sharing电子表格链接https://docs.google.com/spreadsheets/d/1tyz_3WeEkmY4WX8Xvx38nkLow8hcbCjPMLS1-NiPFgo/edit?usp=sharing
Dev Link https://script.google.com/macros/s/AKfycbxIT4fJPNyD5U2CKFzWCSho0tR2uuczq1hevzHawtg/dev开发链接https://script.google.com/macros/s/AKfycbxIT4fJPNyD5U2CKFzWCSho0tR2uuczq1hevzHawtg/dev
So now all the above fields like name, email, date of birth will be saved and can be re-edited.所以现在上面的所有字段,如姓名,email,出生日期都将被保存并可以重新编辑。
I added 2 more column below Phone Number & Country Daily Updates
and Daily Logs
我在电话号码和国家/地区
Daily Updates
和Daily Logs
下方添加了 2 列
Now when i edit a user and update today's activity in Daily Updates
like Something added on - 1-jan-2021
Now it should clear field in Daily Updates
and should be updated in Daily Logs field
.现在,当我编辑用户并在
Daily Updates
中更新今天的活动时,例如Something added on - 1-jan-2021
现在它应该清除Daily Updates
中的字段,并且应该在Daily Logs field
中更新。 If i update Something added on 2-jan-2021
in Daily Updates
again it should be cleared and appear in Daily Logs
field as previous and current如果我在
Daily Updates
中再次更新Something added on 2-jan-2021
,则应将其清除并在Daily Logs
字段中显示为先前和当前
Something added on - 1-jan-2021
Something added on 2-jan-2021
So my goal is display all changes done to Daily Updates
field should be appear in Daily Logs
field as read only this can't be edited.所以我的目标是显示对
Daily Updates
字段所做的所有更改都应显示在Daily Logs
字段中,因为只读,无法编辑。
I believe your goal is as follows.我相信你的目标如下。
In this case, how about the following modification?在这种情况下,如何进行以下修改?
In this case, please modify the function updateData
in Google Apps Script side as follows.在这种情况下,请在 Google Apps Script 端修改 function
updateData
如下。
function updateData(values, spreadsheetId, range) {
var valueRange = Sheets.newValueRange();
valueRange.values = values;
var result = Sheets.Spreadsheets.Values.update(valueRange, spreadsheetId, range, { valueInputOption: "RAW" });}
function updateData(values, spreadsheetId, range) {
var len = values[0].length;
values[0][len - 1] = values[0][len - 1] ? `${values[0][len - 1]}\n${values[0][len - 2]}` : values[0][len - 2];
values[0][len - 2] = "";
var valueRange = Sheets.newValueRange();
valueRange.values = values;
var result = Sheets.Spreadsheets.Values.update(valueRange, spreadsheetId, range, { valueInputOption: "RAW" });
}
Daily Logs field as read only this can't be edited.
Daily Logs field as read only this can't be edited.
, in this case, please put readonly="readonly"
to the textarea tag of "Daily Logs". readonly="readonly"
放在“Daily Logs”的 textarea 标签中。 From the following reply,从下面的回复中,
IF i add more fields like Last name, job field, etc,,, i keep adding extra columns in spreadsheet.
如果我添加更多字段,例如姓氏、工作字段等,我会继续在电子表格中添加额外的列。
In this case, how aobut using the column number as follows?在这种情况下,如何使用列号如下?
function updateData(values, spreadsheetId, range) {
var colDailyChanges = 8; // Column "H"
var colDailyLogs = 9; // Column "I"
values[0][colDailyLogs - 1] = values[0][colDailyLogs - 1] ? `${values[0][colDailyLogs - 1]}\n${values[0][colDailyChanges - 1]}` : values[0][colDailyChanges - 1];
values[0][colDailyChanges - 1] = "";
var valueRange = Sheets.newValueRange();
valueRange.values = values;
var result = Sheets.Spreadsheets.Values.update(valueRange, spreadsheetId, range, { valueInputOption: "RAW" });
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.