[英]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,我已经知道以下两种方法:
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它有效,但感觉我做得太过分了,此外似乎还有性能问题
=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:它是:
ArrayFormula(Sheet1!A2:G500)
for the 499 lines, or ArrayFormula(Sheet1!A2:G500)
对于 499 行,或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.