简体   繁体   English

根据另一个标签中的新行在表格顶部插入新行

[英]Insert new row at top of sheet based on new rows in another tab

I have a Google sheet with a listing of job candidates in one tab (Primary candidates sheet). 我有一个Google工作表,其中在一个标签中列出了应聘者列表(主要应聘者工作表)。 What I would like to do is paste a daily export of candidates into another tab and have new candidates from the latest export inserted up top of the primary candidates sheet. 我想做的是将候选人的每日导出粘贴到另一个选项卡,并将最新导出的新候选人插入到主要候选人表的顶部。

I've tried to search this methodology online which typically leads to success after some research. 我尝试过在线搜索此方法,通常会在进行一些研究后获得成功。 However, I can't seem to find any documentation on macros, scripts, or formulas which could accomplish this. 但是,我似乎找不到任何可以完成此操作的有关宏,脚本或公式的文档。

Wanted to see if anyone had any resources for additional research. 想看看是否有人有任何其他研究资源。

You can use below code to copy data from source sheet into top of destination sheet. 您可以使用以下代码将数据从源工作表复制到目标工作表的顶部。 Enter sheet names accordingly. 相应地输入工作表名称。 Save. 救。 From script editor menu, Run > Function > Test , to test. 从脚本编辑器菜单中, 运行>功能>测试进行测试。 It'll insert new rows in destination sheet and source sheet data will stay as is. 它将在目标工作表中插入新行,而源工作表数据将保持原样。

function test() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var source = ss.getSheetByName('source sheet name here'); // change here
  var des = ss.getSheetByName('destination sheet name here'); // change here

  var sv = source
    .getDataRange()
    .getValues();
  sv.shift();
  des.insertRowsAfter(1, sv.length);
  des.getRange(2, 1, sv.length, source.getLastColumn()).setValues(sv);
}

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

相关问题 筛选清单、将范围复制/粘贴到另一个工作表(基于单词匹配的位置)、根据需要插入新行、单击按钮启动、重置工作表 - Filter Checklist, Copy/Paste Range to another Sheet (Location Based on Word Match), Insert New Rows as Needed, initiate on Button Click, Reset Sheet 根据“是”将行移动到新书/页 - Move rows based on “yes” to new book/sheet 将 A 列的单行 onEdit 复制到“新建”到另一个 Google 电子表格 - 不是同一工作表中的选项卡 - Copy a single row onEdit of Column A to "New" to another Google spreadsheet - NOT tab in the same sheet 根据单元格中的值将行复制到新工作表 - Copy a row to new sheet based on value in a cell Google表格/表单在顶部插入新行 - Google Sheets / Form Insert New Row at the Top 如何插入更新的 [非空] 值作为另一张纸上的新行? - How do I insert the updated [non-null] value as the new row on another sheet? 在 Google 表格中插入新行并将预先格式化的行复制到其中 - Insert new row in a Google Sheet and copy a pre-formatted row into it 将行值复制到新工作表中(如果另一工作表中存在) - Copy row values to a new sheet if it exist in another sheet 工作表自动更新后将行移动到新选项卡 - Move row to new tab after sheet updates automatically Google表格脚本可在C列之后插入新行 - Google Sheet Script to Insert new row after column C
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM