简体   繁体   English

从母版工作表的最后一行复制数据,并将其粘贴到Google工作表中另一工作表的特定单元格

[英]Copy data from last row of master sheet and paste it in specific cells in another sheet in google sheets

I want to copy data from the last row of my master sheet which populates using a google form and paste it into a new sheet that is created when a form is submitted. 我想从使用Google表单填充的主表的最后一行复制数据,并将其粘贴到提交表单时创建的新表中。 Now, I want the new sheet to automatically put certain text in specific cells and copy data from the last row in some specific cells. 现在,我希望新工作表自动将某些文本放在特定的单元格中,并从某些特定的单元格的最后一行复制数据。 Example-: The master sheet 示例-: 主表

now i want to copy the data in cell b2 (assuming 2 is the last row) to newly created sheet in the cell b1 from cell c2 to b3 from cell d2 to b4 from cell AL2 to h20 and so on. 现在我想将单元格b2中的数据(假设2是最后一行)复制到单元格b1中从单元格c2到b3的新创建工作表,从单元格d2到单元格AL2到h20的b4,依此类推。 I am new to google appscript. 我是Google Appscript的新手。 Any help would be appreciated. 任何帮助,将不胜感激。

I don't what you meant by and so on. 我不是您的意思,依此类推。 But here's the instructions that you specified so far. 但是,这是您到目前为止指定的说明。

function copyMasterToNewSheet()
{
  var ss=SpreadsheetApp.getActiveSpreadsheet();
  var sht=ss.getSheetByName('The Master Sheet');
  var rng=sht.getDataRange();
  var rngA=rng.getValues();
  var row=rngA[rngA.length-1];
  var newsht=ss.insertSheet(row[0]);//It's name is the TimeStamp
  newsht.getRange('B1').setValue(row[1]);
  newsht.getRange('B3').setValue(row[2]);
  newsht.getRange('B4').setValue(row[3]);
  newsht.getRange('H20').setValue(row[37]);
  SpreadsheetApp.flush();
}

You would need to hook this up to the on Form Submit trigger. 您需要将其连接到“表单提交”触发器上。

暂无
暂无

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

相关问题 从最后一行复制特定的列数据并粘贴到另一个工作表 - Copy specific Columns data from Last Row and paste to another sheet 将谷歌工作表中的数据复制到另一个谷歌工作表的最后一行 - Copy data from a google sheet to the last row in another google sheet 谷歌脚本将特定列从一张纸复制到另一张纸上的最后一行 - Google Script to copy specific columns from one sheet to another sheets last row onEdit Google Sheets 将行复制并粘贴到另一个工作表中,然后从第一个工作表中删除内容 - Google Sheets copy and paste row into another sheet and then delete content from the first sheet 用于在最后一条记录后复制并粘贴到另一个工作表的 Google Sheets 脚本 - Google Sheets script to copy and paste in another sheet after the last record 从Google驱动器中可用的所有工作表中复制特定的单元格值,然后使用应用脚本粘贴到主工作表中 - Copy specific cell value from all sheets which are available in the google drive and paste in master sheet with apps script 使用 GAS batchUpdate 将数据从 Google 表格自定义表单上的特定单元格复制到同一电子表格中不同工作表上的特定行 - Using GAS batchUpdate to copy data from specific cells on a Google Sheets Custom form to a specific row on a different sheet in the same Spreadsheet Google表格:根据复选框从一张纸复制并粘贴到另一张纸 - Google Sheets: Copy and Paste from one sheet to another based on checkbox 脚本将一些单元格复制到特定工作表上另一个电子表格的最后一行? - script to copy some cells to last row of another spreadsheet at specific sheet? 尝试将数据从源 Google 工作表的最后一行复制并粘贴到目标工作表的最后一行时似乎出现错误 - Seem to be getting an error when trying to copy and paste data from last row of the source google sheet to the target sheet last row
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM