Sheets Tip 199: IMPORTRANGE Backlink To Source Sheet



Hi Reader,

Welcome to the Google Sheets Tips newsletter #199!

➜ News

I.
​
Love them or hate them, you'll soon be able to express your feelings with emojis in the comments of Google Docs. No word on whether this is coming to Sheets though. πŸ€“ 🧐 πŸ‘

​New Emoji reactions in Google Docs on web​

II.​
Mainstream publications don't write about spreadsheets very often β€” they're dreadfully boring compared to web3 and NFT's! β€” but when they do I make sure to read it. Wired recently covered innovation in the space:

​Spreadsheets Are Hotβ€”and Cranking Out Complex Code​

_______

➜ Google Sheets Tip #199: IMPORTRANGE and backlinks to source Sheet

Here is your Google Sheets tip, which you can think of as your Monday morning espresso, in spreadsheet form.

Google Sheets are files in the cloud, not on our desktop, so we can't simply point at a cell in a different Sheets file and expect them to connect.

Instead, we use the IMPORTRANGE function to copy data from one Google Sheet file to another.

Part 1: IMPORTRANGE

Suppose we have yearly sales data in separate Google Sheet files and we want to consolidate it into a single Sheet.

Use IMPORTRANGE to copy data from each yearly Sheet into a single Sheet.

The formula looks like this:

=IMPORTRANGE( "[URL]","Sheet1!A1:D100")

where [URL] is the URL of the source data Sheet and Sheet1!A1:D100 is the range of data, e.g.:

IMPORTRANGE data
​

When you setup the IMPORTRANGE function for the first time, you're prompted to allow access between the two Sheet files.

Part 2: IMPORTRANGE Backlink Formula

Now, what about going the other way? From the destination Sheet back to the source Sheet?

Of course, we could click into the formula bar, copy the URL, and then open that in our web browser, but that's not an elegant way to do it. Plus, it's easy for users to break the formula accidentally or copy the URL incorrectly.

Instead, we can add a link, like this:

IMPORTRANGE hyperlink formula
​

The formula lets a user click directly to the source Sheet.

This formula in A1 will create a link to the source Sheet of an IMPORTRANGE formula in cell A2:

=HYPERLINK(REGEXEXTRACT(FORMULATEXT(A2),"""(.+?)"""),"Source "&CHAR(8599))

Peeling it apart with the onion framework, it works as follows:

FORMULATEXT converts the IMPORTRANGE to a formula string.

Next, REGEXEXTRACT extracts the URL part of the formula string. The REGEX rule is """(.+?)""" which has 3 double quotes each side of the bracket expression.

Then, HYPERLINK turns this URL into a clickable link.

Finally "Source "&CHAR(8699) shows pretty link text, instead of the full URL.

This might be a nice touch to add links back to source files for your important documents!

_______

If you enjoyed this newsletter, please forward it to a friend who might enjoy it.

Have a great week!

Cheers,
Ben

P.S. The only engineering cheat sheet you need...​

Google Sheets Tips

Get better at working with Google Sheets! Join 50,000 readers to get an actionable tip in your inbox every Monday.

Read more from Google Sheets Tips
Add a QA check to prompts to make them more accurate

Hi Reader, Welcome to the Future Proof newsletter, your Monday morning espresso, in AI form! (Formerly the Google Sheets Tips newsletter.) One of the stories that jumped out to me in the past week came from an interview with a tearful Cornell mathematics professor, asking "what's the point?" when AI surpasses human ability and steals the meaning (and joy) from mathematical research. (Which is a calling, not just a job to many.) One line stuck with me, and I'm paraphrasing here, but basically,...

Add custom Gemini instructions in sidebar of Google Sheets

Hi Reader, Welcome to the Future Proof newsletter issue 5, your Monday morning espresso, in AI form! (Formerly the Google Sheets Tips newsletter.) Lots of Gemini and Google Workspace news to share today and a tip on custom instructions. Find it all below, but first a little anecdote from my weekend. Kids say the funniest things. My 9-year-old declared over the weekend that he was going to build his own AI company and call his AI tool "Psycho"! I laughed and told him I loved the name. I was...

Output Google Doc as markdown file

Hi Reader, Welcome to Future Proof #4 (formerly the Google Sheets Tips newsletter), your Monday morning espresso, in AI form! My son and I had some fun 3-D printing over the weekend. I printed a rugged case to hold my Field Notes journals (see the finished result at the end of this email). The print run just beginning. It's impressive to watch something grow from nothing, although since the full print took around 3 hours I didn't watch the whole thing ;) And now, perhaps more than ever...