简体   繁体   English

Google Sheet:如何使用 arrayformula 将数据从一张表复制到另一张表?

[英]Google Sheet: How to use arrayformula to copy data from one sheet to another?

In a Google spreadsheet, I want to sync A2:G500 in sheet1 to sheet2, I've been aware of the following two methods:在Google电子表格中,我想将sheet1中的A2:G500同步到sheet2,我已经知道以下两种方法:

  1. use IMPORTRANGE : put the following formula in A1 of sheet2:使用IMPORTRANGE :将以下公式放在 sheet2 的 A1 中:

    =IMPORTRANGE(" spreadsheet_url ",sheet1!A2:G500) =IMPORTRANGE("电子表格网址",sheet1!A2:G500)

It works but it feels like I am overdoing it, besides there seem to be a performance issue它有效,但感觉我做得太过分了,此外似乎还有性能问题

  1. In A2 of sheet2, put formula =sheet1!A2 , then drag the formula to G500 in sheet2.在sheet2的A2中,输入公式=sheet1!A2 ,然后将公式拖到sheet2中的G500。 This one is intuitive and simple to do.这是一种直观且易于操作的方法。 However, it doesn't work if sheet1 is a form response sheet - when new response is added, sheet2 won't automatically get it.但是,如果 sheet1 是表单响应表,则它不起作用 - 添加新响应时,sheet2 不会自动获取它。

For learning purpose, I'm wondering if there is a way to do this using Arrayformula .出于学习目的,我想知道是否有办法使用Arrayformula来做到这Arrayformula Besides, I want to find a way to make this sync more care-free, meaning if there are indefinite rows of data I won't have to go back to this sheet every now and then and change the formula or manually drag the formula.此外,我想找到一种方法使这种同步更加无忧无虑,这意味着如果有不确定的数据行,我将不必时不时地返回到此工作表并更改公式或手动拖动公式。 Is this possible?这可能吗? And is Arrayformula the right way to go for this purpose? Arrayformula是实现此目的的正确方法吗?

=ARRAYFORMULA(Sheet1!A:G)

这不起作用吗?

It's either:它是:

  1. ArrayFormula(Sheet1!A2:G500) for the 499 lines, or ArrayFormula(Sheet1!A2:G500)对于 499 行,或
  2. ArrayFormula(Sheet!A2:G) if you wanto sync everything from line 2 down ArrayFormula(Sheet!A2:G)如果你想从第 2 行开始同步所有内容

I would recommend an { array expression } , like this:我会推荐一个{ array expression } ,如下所示:

={ Sheet1!A2:G }

I prefer this syntax because it allows you to specify non-adjacent columns, like this:我更喜欢这种语法,因为它允许您指定不相邻的列,如下所示:

={ Sheet1!A2:C, Sheet1!E2:E, Sheet1!G2:G }

In this example, columns D and F are skipped.在此示例中,跳过了D列和F列。

try in row 1:在第 1 行尝试:

={""; INDEX(sheet1!A2:A)}

this will solve your form issues when you use it in 1st row.当您在第一行使用它时,这将解决您的表单问题。 if you already have something in your row 1 you can add it into double quotes like this:如果您的第 1 行中已经有一些内容,您可以将其添加到双引号中,如下所示:

={"header"; INDEX(sheet1!A2:A)}

in case of multiple columns its like this:在多列的情况下,它是这样的:

={"","","","","","",""; INDEX(sheet1!A2:G)}

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

相关问题 如何使用 Google Sheet Script 将数据范围从一个工作表复制到另一个工作表 - How to Copy a data range from one sheet to another sheet using Google Sheet Script Google Spreadsheet-如何将单元格数据从一张工作表复制到另一张工作表中的单元格? - Google Spreadsheet - How to copy cell data from one sheet to a cell in another sheet? 如何在下一个空白行将数据从一个 Google 表格复制到另一个表格 - How to Copy Data from One Google Sheet to Another Sheet at the next blank row 将数据从一个 Google 工作表工作簿工作表复制到另一个工作簿 - Copy Data from One Google sheets Workbook Sheet to another Workbook 使用 Google App Script 将所有数据从一张纸复制到另一张纸 - Copy all data from one sheet to another with Google App Script 将数据从一张纸复制到另一张 - Google Script - Copy Data from one sheet to another - Google Script 如何将一个Google工作表复制到另一个Google工作表 - How to copy one google sheet to different another google sheet 如何在谷歌表格中使用 sumif 和 arrayformula - How to use sumif with arrayformula in google sheet Google文件-指令码,将储存格从一张工作表复制到另一张工作表 - Google Docs - Scripts, copy cell from one sheet to another sheet 将范围从一个工作表复制到Google工作表中的另一个工作表 - Copy a range from one sheet to another in google sheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM