简体   繁体   English

将数据从一张纸复制到另一张 - Google Script

[英]Copy Data from one sheet to another - Google Script

I'm trying to run a code that lets me copy the value of any single cell in one sheet and then paste it into a specific cell in another sheet, however I've been getting errors saying "Range not found".我正在尝试运行一个代码,该代码允许我复制一张表中任何单个单元格的值,然后将其粘贴到另一张表中的特定单元格中,但是我收到错误消息“找不到范围”。

function Find() {
  var spreadsheet = SpreadsheetApp.getActive();
  var currcell = spreadsheet.getCurrentCell();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Exp GPPB Breakdown'), true);
  spreadsheet.getRange('C1').activate();
  spreadsheet.getRange(currcell).copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
  spreadsheet.getRange('A4').activate();
  var criteria = SpreadsheetApp.newFilterCriteria()
  .build();
  spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(1, criteria);
};

Replace代替

var currcell = spreadsheet.getCurrentCell();

with

var currcell = spreadsheet.getActiveSheet().getCurrentCell().getA1Notation();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google 工作表脚本将数据集从一张工作表复制到另一张工作表的顶部(仅限值) - Google sheets script copy data sets from one sheet to another (values only) at the top of the sheet Google 工作表应用程序脚本 - 根据循环条件将数据从一张工作表复制到另一张工作表 - Google sheet app script - Copy data from one sheet to another based on condition with loop 将范围从一个工作表复制到Google工作表中的另一个工作表 - Copy a range from one sheet to another in google sheet Google Apps Script - onEdit 使用数组将数据从一张纸复制到另一张纸 - Google Apps Script - onEdit using an Array to Copy data one sheet to another google脚本:根据触发将公式计算出的值从一张纸复制到另一张纸上(在编辑或时间驱动下) - google script: To copy the value calculated by formula from one sheet to another based on TRIGGER (on edit or time driven) Google Spreadsheets 脚本 - 如何将范围从一张纸复制到另一张纸,但不覆盖非空目标单元格 - Google Spreadsheets script - How to copy range from one sheet to another sheet, but without overwriting non-empty target cells 用于匹配和复制基于另一个相邻单元格的 Google 表格脚本 - Google sheet script to match and copy based from another adjacent cell Google电子表格将值从一行复制到另一张工作表 - Google spreadsheet copy values from one row to another sheet 根据条件将单元格值从一个Google工作表复制到另一个 - Copy cell values from one google sheet to another based on condition 将一行从一个Google表格电子表格复制到表单提交中的另一表格 - Copy a row from one Google Sheet Spreadsheet to Another on Form Submit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM