简体   繁体   English

复制一个范围并仅将带有值的行粘贴到下一个空白行的另一个工作表中?

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

相关问题 复制一个范围并仅将具有值和图像的行粘贴到另一个工作表中下一个空白行的谷歌工作表中? - Copy a range and paste only rows with values & images into another sheet at the next blank row in the google sheets? 从范围复制单元格值并将其粘贴到另一个工作表的单行中 - To copy Cell values from a range and paste it in a single row of another sheet 需要将另一张纸中的格式和值都复制到空白的下一行 - Need to copy both the format and values in another sheet to the next row that is blank 如何复制值并将其粘贴到另一张纸上的下一个可用行中? - How do I copy values and paste them into the next available rows on another sheet? 将多行复制并粘贴到另一张纸上的下一个空行中 - Copying and Paste multiple rows into next empty Row on another sheet 将粘贴复制到另一张纸并找到没有空行的最后一行 - Copy paste to another sheet and find last row without empty rows 仅从一张纸复制值并粘贴到另一张纸上 - copy only values from one sheet and paste to another 如何从源范围复制数据并仅将包含内容的行粘贴到单独的目标工作簿工作表中,按日期值排序 - How to copy data from source range and paste only rows with content to a separate target workbook sheet, sorted by date values 如何将范围从一个工作表复制到另一工作表的范围,然后重复复制到下一行 - How to copy a range from one sheet to a range in another sheet, then repeat copying to the next row down Select 单元格(Ctrl+A)然后复制范围并粘贴到另一个工作表的第一个空行 - Select cells(Ctrl+A) then Copy range and paste to another sheet's first empty row
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM