21

I have data in one google docs. Call it docA.

I would like to reference this data in docB. Something along the lines of =docA!Sheet1!A2

How would I be able to go about this? I do not mind changing security settings and the like

Rubén
  • 34,714
  • 9
  • 70
  • 166
mhopkins321
  • 2,993
  • 15
  • 56
  • 83

1 Answers1

23

First go to the spreadsheet that you want to import the data from (docA) and observe the value of the key mentioned in the URL (Eg: https://docs.google.com/spreadsheet/ccc?key=ABC#gid=0, in this case the key is "ABC").

Now go to the cell in docB and use the importRange function to import the data.

=importRange(, !:)

Eg: =importRange("ABC", "Sheet1!A1:B10")

If you want to import just one cell: E.g. =importRange("ABC", "Sheet1!A1");

If you don't mention the name of the sheet, the first sheet is used.

supreethwhoelse
  • 354
  • 2
  • 2
  • I've noticed that the value doesn't update when the source document is changed. Any ideas on data auto-refresh when source is saved? – DougA Feb 05 '14 at 02:22
  • @DougA it updates for me, it just takes a little while (like a minute) – badsyntax May 08 '14 at 10:56
  • 6
    HUGE note: This also works with Excel spreadsheets that have been uploaded to Google Drive and have been opened in Google Sheets without converting them to a Google Sheet. This is huge, allowing Google Sheet's users to link to information in old school Excel sheets without disrupting the people who work on those Excel sheets. As long as they are somehow backup up with Google Drive... which is an article on it's own. – Ray Foss Mar 04 '16 at 20:37
  • 2
    It appears that the Google URL format has changed, there's no `key` GET key anymore. Instead it seems the [full URL](https://support.google.com/docs/answer/3093340) should be used. – Gruber Jan 11 '19 at 12:49