简体   繁体   English

使用复选框将数据从特定单元格复制到另一个工作表(任务完成后变为 false)

[英]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.

相关问题 将数据从工作表中的特定单元格复制到另一个工作表 - copy data from specific cell in a sheet to another sheet Google Spreadsheet-如何将单元格数据从一张工作表复制到另一张工作表中的单元格? - Google Spreadsheet - How to copy cell data from one sheet to a cell in another sheet? Google Spreadsheet-脚本,每天在特定时间将单元格从一张工作表复制到另一张工作表 - Google Spreadsheet - Scripts, copy cell from one sheet to another sheet EVERYDAY at a specific time 将数据从一张纸复制到另一张电子表格,但不包括特定的列 - Copy data from one sheet to another spreadsheet exclude specific columns 根据特定的键值将数据从一张纸复制到另一张纸 - Copy data from one sheet to another based on a specific key value 如何将特定列的数据从一张表复制到另一张表 - How to copy specific columns of data from one sheet to another 从最后一行复制特定的列数据并粘贴到另一个工作表 - Copy specific Columns data from Last Row and paste to another sheet 当特定条件为真时,将值从一张纸复制到另一张纸 - copy values from one sheet to another when a specific condition is true Google Scripts:当复选框为真时,将工作表 A 中的行复制到工作表 B。当复选框为假时,从工作表 B 中删除复制的行 - Google Scripts: When checkbox true, copy row from sheet A to sheet B. When checkbox false, delete copied row from sheet B 在工作表之间传输特定的单元格数据 - Transferring specific cell data from sheet to sheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM