简体   繁体   English

仅从一张纸复制值并粘贴到另一张纸上

[英]copy only values from one sheet and paste to another

I am using below sample code to copy only values from one sheet and paste to another.我正在使用下面的示例代码仅从一张表中复制值并粘贴到另一张表中。 But here it paste my formula also from source file.但在这里它也从源文件中粘贴了我的公式。 I want only value and format(dont want formula) to be copied from source and paste to destination sheet.我只想从源复制值和格式(不想要公式)并粘贴到目标工作表。 how it can be done in google spreadsheet scripts?如何在谷歌电子表格脚本中完成?

function copyInfo() { 
  var ss = SpreadsheetApp.getActiveSpreadsheet(); 
  var copySheet = ss.getSheetByName("Copy"); 
  var pasteSheet = ss.getSheetByName("Paste"); 
  // get source range 
  var source = copySheet.getRange(2,2,12,2); 
  // get destination range 
  var destination = pasteSheet.getRange(pasteSheet.getLastRow()+1,2,12,2); 
  // copy values to destination range 
  source.copyTo(destination); 
  // clear source values 
  source.clearContent(); 
}

I have almost same kind of situation.我几乎有同样的情况。 I have to copy data form sheet "Important work" 'range B4: M getlast row' and paste it into "sheet 8" below last row please correct this code...我必须复制数据表“重要工作”“范围 B4:M getlast 行”并将其粘贴到最后一行下方的“表 8”中,请更正此代码...

function copyInfo() { 
  var ss = SpreadsheetApp.getActiveSpreadsheet(); 
  var copySheet = ss.getSheetByName("Important work"); 
  var pasteSheet = ss.getSheetByName("Sheet8"); 
  // get source range 
  var source = copySheet.getRange(4,2,copySheet.getLastRow(),13); 
  var source1 = source.getValues()
Logger.log(source1);
  // get destination range 
  var paste1 = pasteSheet.setRange(pasteSheet.getLastRow()+1,1,1,13); 
    
  // copy values to destination range
  source1.setValues(paste1); 
  // clear source values 
  source1.clearContent(); 
}

暂无
暂无

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

相关问题 仅将值从一张纸复制到另一张纸 - Copy values only from one sheet to another 自动将值从一个谷歌工作表复制并粘贴到另一个 - Automatically copy and paste values from one google sheet to another 用于从一张纸复制并粘贴到另一张纸的数组 - An Array to copy and paste from one sheet to another 仅将值从一个谷歌工作表复制到另一个的脚本不起作用 - script to copy values only from one google sheet to another is not working 如何使用 Google Sheets Macros 从一张工作表复制值并将它们粘贴到另一张工作表中? - How to copy values from one sheet and paste them into another using Google Sheets Macros? 将背景颜色从一列复制/粘贴到具有匹配值的列中的另一张工作表 - Copy / paste background color from one column to another sheet in a column with matched values 使用 AppScript 将行从一张表复制粘贴到另一张比较单元格值以避免重复 - Copy-Paste rows from one sheet to another comparing cell values to avoid duplicates using AppScript 从范围复制单元格值并将其粘贴到另一个工作表的单行中 - To copy Cell values from a range and paste it in a single row of another sheet 将单元格值从一张纸复制并粘贴到另一张onEdit - copy and paste cell value from one sheet to another onEdit Google 工作表脚本将数据集从一张工作表复制到另一张工作表的顶部(仅限值) - Google sheets script copy data sets from one sheet to another (values only) at the top of the sheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM