简体   繁体   中英

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:

  1. use IMPORTRANGE : put the following formula in A1 of sheet2:

    =IMPORTRANGE(" spreadsheet_url ",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. 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.

For learning purpose, I'm wondering if there is a way to do this using 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(Sheet1!A:G)

这不起作用吗?

It's either:

  1. ArrayFormula(Sheet1!A2:G500) for the 499 lines, or
  2. ArrayFormula(Sheet!A2:G) if you wanto sync everything from line 2 down

I would recommend an { array expression } , like this:

={ 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.

try in row 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:

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

in case of multiple columns its like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM