
Making Google Sheets Pull Data From Website Tables and Portals
Put =IMPORTHTML("https://example.com/prices", "table", 1) or =IMPORTXML("https://example.com/prices", "//td") into a cell for any public page whose data sits in plain HTML, or describe the rows to BrowseWiz in Chrome when the page requires a login or loads through scripts.
The right method depends on who opens the page, not how clever your formula is. A spreadsheet formula fetches a URL from Google's servers with none of your cookies or logins, while a browser extension reads the exact page you already see. Settle that distinction first and you will skip hours of debugging #N/A errors.
The Formula Syntax for Public Tables and Lists
=IMPORTHTML("PAGE_URL", "table", TABLE_NUMBER)
=IMPORTXML("PAGE_URL", "XPATH_QUERY")In both formulas, PAGE_URL is the full web address wrapped in double quotes. For IMPORTHTML, the second argument is either "table" or "list", and TABLE_NUMBER counts from 1 to pick which matching element on the page you want, as documented in the IMPORTHTML help page. For IMPORTXML, XPATH_QUERY targets specific HTML elements, such as "//h3" for every third-level heading or "//td" for every table cell.
A working example for a public pricing page looks like this:
=IMPORTHTML("https://example.com/prices", "table", 1)Keep the target page light when you pull data into a sheet. Google's Sheets API documentation recommends a 2 MB maximum payload per API request to speed up requests. Pulling a massive directory page into a single cell slows recalculation and makes the sheet unresponsive. ➀
Setting Up a Live Web Import From Scratch
- Open the target webpage in your browser and inspect the page source to confirm the data appears in raw HTML rather than loading after the page renders.
- Copy the full URL from the address bar, including
https://. - Open a blank tab in Google Sheets and click cell
A1so the imported rows have room to expand downward and to the right without overwriting existing data. - Enter
=IMPORTHTML("URL", "table", 1)if the data sits in a standard HTML table, or=IMPORTXML("URL", "//tr")if you need a custom XPath query. - Press Enter and wait for Google Sheets to fetch the page; when Sheets processes a request for more than 180 seconds, the request returns a timeout error.
- Adjust the
TABLE_NUMBERindex to2,3, and so on if the first table on the page is a layout wrapper or navigation bar rather than the dataset you want.
Common Failures and How to Spot Them
Blank cells or #N/A with the message "Imported content is empty" almost always mean the website builds its table with JavaScript after the initial HTML loads. Google's formula engine reads only the raw HTML response, so it never sees the rows your browser paints a second later. You can verify this in ten seconds by viewing the page source in Chrome and searching for a word from the table; if it is missing from the source, no formula will ever read it.
Redirect loops and login walls produce the same #N/A error, even when the page is open in your next browser tab. Formulas run on Google's servers, not on your machine, so they arrive at the URL completely logged out. Any portal, dealer dashboard, or supplier catalog that asks for a password will hand Google Sheets a sign-in form instead of your data.
Broken layouts happen without warning whenever a site owner adds a banner table above the main content or renames a CSS class. Your TABLE_NUMBER shifts from 1 to 2, or your XPath query returns nothing, and the spreadsheet either goes blank or fills with the wrong columns. Checking our breakdown of five ways to import data helps you match the fragility of the site to a method that will survive the next redesign.
Overwriting adjacent cells triggers a #REF! error that says "Array result was not expanded because it would overwrite data." Because IMPORTHTML and IMPORTXML spill downward and across as many rows and columns as the source page contains, typing notes or totals next to an active import formula breaks the entire block. Keep raw imports on their own dedicated tab and reference them from a separate summary tab.
Choosing Between Formulas, Scripts, and a Browser Extension
Start with a built-in formula if the page is public, renders in plain HTML, and only needs occasional refreshes. You pay nothing, install nothing, and keep the entire setup inside one cell.
Move past formulas the moment your data lives behind a login, spans paginated cards, or requires clicking filters before the rows appear. Writing a custom Google Apps Script can handle public JSON APIs, yet it still runs on Google's servers and cannot borrow your signed-in Chrome session. You also take on the maintenance every time an endpoint changes.
You might also look at Google's built-in AI tools inside Sheets, such as the AI function in Google Sheets. That function answers from Google Search rather than opening a specific logged-in portal you name, and it does not run scheduled refreshes on your target URLs. Our Gemini in Sheets alternative page lays out the exact differences if you are weighing the two.
Pick a browser extension when you need repeatable rows from real websites you already use in Chrome. You avoid uploading cookies or passwords to a third-party cloud server, and you skip writing brittle XPath selectors that snap on the next site update.
How BrowseWiz Keeps Web Data Current in Google Sheets
We built BrowseWiz for the exact point where spreadsheet formulas fail. BrowseWiz runs as an extension in your own Chrome, using the browser session you are signed into without cookie export or stored passwords. You describe the rows you want in plain words, with no selectors or scrapers to build or fix.
BrowseWiz creates a new Google Sheet in your Google Drive and keeps writing to that sheet; it does not edit a sheet you already have. When you ask for a source column, every row links back to the page it came from, and previous values can be kept in their own column when you ask for one.
We are upfront about where it fits and where it does not. Scheduled refreshes and monitors run only while Chrome is open; if Chrome was closed when a run was due, it runs soon after Chrome opens again as one catch-up run. If a site signs you out, you must sign in again in Chrome.
If you want to set up a recurring sheet from a portal or multi-page site, reach out through our contact page with the workflow you have in mind, or compare the Free, Pro, and Max tiers on our pricing page.
Frequently Asked Questions
How do I pull data from a webpage?
For a single small table on a public page, copy and paste it directly into a spreadsheet. For a public HTML table that updates occasionally, place =IMPORTHTML("URL", "table", 1) or =IMPORTXML("URL", "XPATH") in an empty cell. When the page requires a login, loads via JavaScript, or spans multiple pages, use a Chrome extension like BrowseWiz so it reads the rendered page in your signed-in browser and writes the rows into a new Google Sheet.
Is web scraping on Google legal?
Collecting publicly available data from websites is generally legal in many jurisdictions, provided you do not bypass technical access controls, violate privacy laws, or copy protected personal data unlawfully. Websites still enforce their own terms of service and rate limits, and automated tools that hammer servers or harvest private account records can get accounts suspended. Keep your collection focused on data you are authorized to view in your own browser and respect each site's rules.
Can I pull data into Google Sheets via API?
Yes, you can use Google Apps Script with UrlFetchApp to call a public or authenticated REST API, parse the JSON response, and write the values into your sheet cells. You can also push rows into a spreadsheet from an external script using the Google Sheets API. Both approaches require maintaining code and API keys, and they only work when the target website actually exposes an API rather than serving data solely through web pages.

About Tom
I'm a software engineer and solutions architect specializing in AI-driven tools and productivity software, passionate about helping users reclaim their valuable time through intelligent automation.
This article was written with AI and reviewed by Tom.