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