[英]To Copy data from specific cell to another sheet using a checkbox(turn false when task is done)
Need to copy data from 2 cells and paste it on sheet2 and clear the textboxes from Sheet1 Link https://docs.google.com/spreadsheets/d/1RiLjepEpYhkhCTgMHxrTxSI7GWloj954C4dsq0jT11E/edit?usp=sharing需要从 2 个单元格复制数据并将其粘贴到 sheet2 并清除 Sheet1 链接https://docs.google.com/spreadsheets/d/1RiLjepEpYhkhCTgMHxrTxSI7GWloj954C4dsq0jT11E/edit?usp=sharing中的文本框
Description描述
To monitor if a checkbox has been clicked, (not true or false) you can use an onEdit(e) simple trigger.要监视复选框是否已被单击(不是 true 或 false),您可以使用 onEdit(e) 简单触发器。 When the checkbox is clicked it will momentarily display a check and then the onEdit() clears both the dropdown selections and the checkbox.
单击复选框时,它会立即显示一个复选标记,然后 onEdit() 清除下拉选择和复选框。
I think I have given you enough to get started.我想我已经给了你足够的开始。 I hope you will use the references to research other aspects of Google Spreadsheet and javascript.
我希望您能使用这些参考资料来研究 Google 电子表格和 javascript 的其他方面。
Script脚本
function onEdit(e) {
try {
if( e.range.getSheet().getName() === "Sheet1" ) {
if( e.range.getA1Notation() === "D5" ) {
let range = e.range.getSheet().getRange("C5:C8")
let values = range.getValues();
let picks = values.filter( row => row[0] !== "" ).flat();
let results = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet2");
results.appendRow(picks);
values.forEach( row => row[0] = "" );
range.setValues(values);
e.range.setValue(false);
}
}
}
catch(err) {
SpreadsheetApp.getUi().alert(err);
}
}
Reference参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.