[英]Copy a range and paste only rows with values into another sheet at the next blank row?
I'm trying to build off of what was solved here:我试图建立在这里解决的问题:
How do you copy a range and paste only rows with values into another sheet? 如何复制范围并仅将带有值的行粘贴到另一个工作表中?
I want to do this with a bigger range (O1:X500 on the sheet named "RGDR") copying only the rows with values in them and then paste them in the new sheet ("ACTUALFUNC") in the next blank row.我想用更大的范围(名为“RGDR”的工作表上的 O1:X500)来做到这一点,只复制其中有值的行,然后将它们粘贴到下一个空白行的新工作表(“ACTUALFUNC”)中。
The sheet is here: https://docs.google.com/spreadsheets/d/1vvXQxBGffwBAjbXKqx4N-ZFcX40wuV7gg9flb6STWtA/edit?usp=sharing该表在这里: https : //docs.google.com/spreadsheets/d/1vvXQxBGffwBAjbXKqx4N-ZFcX40wuV7gg9flb6STWtA/edit?usp=sharing
Below is the code I already tried.下面是我已经尝试过的代码。 It only brings over the first column of data.
它只带来第一列数据。
function copyRangeNoEmpties(){
var ss=SpreadsheetApp.getActive();
var sh=ss.getSheetByName('RGDR');
var copyToSheet=ss.getSheetByName('ACTUALFUNC');
var copyFromRange=sh.getRange('O1:X500');
var vA=copyFromRange.getValues();
var oA=[];
for(var i=0;i<vA.length;i++)
{
if(vA[i][0])
{
oA.push([vA[i][0]]);
}
}
var copyToRange=copyToSheet.getRange(1,1,oA.length,1);
copyToRange.setValues(oA);
}
Looking to build a ongoing list of results by running this once daily.希望通过每天运行一次来构建一个持续的结果列表。 Any help or input will be greatly appreciated.
任何帮助或输入将不胜感激。
This will append your data to the next row on your destination sheet.这会将您的数据附加到目标工作表的下一行。
function copyRangeNoEmpties(){
var ss=SpreadsheetApp.getActive();
var sh=ss.getSheetByName('RGDR');
var des=ss.getSheetByName('ACTUALFUNC');
var src=sh.getRange('O1:X500');
var vA=src.getValues();
for(var i=0;i<vA.length;i++) {
if(vA[i].join("")) {
des.appendRow(vA[i]);
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.