Should you need to import data from another spreadsheet in Google Sheets, you can do it a couple of ways. Whether you want to pull the data from another sheet in the file or an entirely different spreadsheet, here’s how.

Import Data from Another Sheet

This first method requires you to have more than one sheet inside of a document. You can see whether your document has more than one sheet by looking at the bottom of the page. And to add another one, just hit the plus sign (+) to create a new one.

Fire up your browser, head to Google Sheets, and open up a spreadsheet. Click and highlight the cell where you want to import the data.

RELATED: The Beginner’s Guide to Google Sheets

Next, you need to type in a formula that references the cell from the other sheet. If your sheets are named, you will want to put its name in place of and the cell you want to reference after the exclamation mark. It should look something like this:

Hit the “Enter” key and the data from the other sheet will show up in that cell.

Import Data from Another Document

In addition to importing data from a sheet within a spreadsheet, you can reference cell(s) from a completely different document. The formula is slightly modified from the previous one but works almost identically.

RELATED: How to Import an Excel Document into Google Sheets

Fire up the document you want to import data from and write down the range of cells to reference. For this guide, we want the range A22:E27.

Next, copy the complete URL of the spreadsheet to the clipboard. Click the address bar, and then use the keyboard shortcut Ctrl+C (Windows/Chrome OS) or Cmd+C (macOS).

Now, head back to the Google Sheets home page and open the spreadsheet where you want to import the data.

Click on an empty cell and type =IMPORTRANGE("" , “”) , where is the link you copied and denotes the cells you want to import that you wrote down. Paste the URL between the quotation marks by pressing Ctrl+V (Windows/Chrome OS) or Cmd+V (macOS), type in the range, and then hit Enter. It should look like this:

Note: If you have more than one sheet in the other document, you must specify which one you want to reference. For example, if you’re importing from Sheet2, you would type “Sheet2!A22:E27” instead.

Hit Enter and you should see the error “#REF!”. This is normal, Google Sheets just needs you to allow it access to the other sheet. Select the cell with the error and then click “Allow Access.”

It should take a couple of seconds to load, but when it’s finished, the data range will import everything directly into your spreadsheet.

Although cell formatting—such as colors—doesn’t follow data over when importing from other sheets, these are the best ways to reference external cells in Google Sheets.