简体   繁体   English

我想根据前一行的单元格中的某些单元格值复制谷歌工作表中下一行的数据

[英]I want to copy data in next rows in google sheet based upon certain cell value in a cell of the Preceding row

I have a large table in google spreadsheet.我在谷歌电子表格中有一张大桌子。 I want to find each row in that table that contains a specific keyword and insert fixed data rows after that row in the whole table.我想找到该表中包含特定关键字的每一行,并在整个表中的该行之后插入固定数据行。

If column 6 in current row is even then add one to column 7 in next row如果当前行中的第 6 列是偶数,则在下一行的第 7 列中加一

function changingdatainnextrowbasedupondataincurrentrow() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet0');
  const vs = sh.getRange(2,1,sh.getLastRow() - 1, sh.getLastColumn()).getValues();
  vs.forEach((r,i,a) => {
    if(r[5] % 2 == 0) {
      a[i + 1][6] += 1;//if column 6 in current row is even then add one to column seven in next row
    }
  });
  sh.getRange(2,1,vs.length, vs[0].length).setValues(vs);
}

暂无
暂无

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

相关问题 将基于单元格值的行数据复制到 Google 表格中的新工作表 - Copy row data based on cell value to new sheet in Google Sheets 根据条件和单元格值将行复制到 Google 表格上的另一张表格 - Copy row to another sheet on Google Sheets based on criteria and cell value 根据单元格中的值将行复制到新工作表 - Copy a row to new sheet based on value in a cell 基于谷歌表格上的单元格值的数据传输 - data transfert based on cell value on google sheet 根据行中单元格中的值将特定行复制到新的Google工作表(JavaScript) - Copy a specific row to new google sheet based on value in a cell in the row (JavaScript) 根据单元格的值将一行数据从一个工作表复制到特定工作表的脚本 - script to copy a row of data from one sheet to a specific sheet based on the value of a cell 如何将单元格编号的值增加 1,然后从一张纸复制到下一张纸的下一个可用行? - How can I increase the value of a cell number by 1, and copy from one sheet to the next sheet's next available row? 根据单元格值将特定范围(不是整行)复制到另一个Google工作表 - Copy over a specific range not whole row to another google sheet based on cell value 根据单元格值自动将行复制到另一个工作表 - Automatically Copy Rows to Another Sheet Based on Cell Value Google Sheet - 根据单元格值而不是行号自动隐藏行 - Google Sheet - Automatically hiding rows based on a cell value instead of a row number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM