Extract data from HTML with AI into a Google Sheet

How to extract data from HTML with AI into a Google Sheet: install the Chrome extension, click Build with Browser agent, tell the agent what you want, and follow its prompts. A working bot is built and tested in minutes.

Here is how the automation works. To extract data from HTML with AI, without CSS selectors, loop through the URLs in a Google Sheet, take each page's HTML with Get data from bot's current page set to Select HTML, and pass it to an Integrate AI step with a prompt naming the values you want. The model reads the markup and returns the values; Find row in a Google Sheet finds the URL's own row and Write data to a Google Sheet writes them into it from column B, beside the link. Nothing on the page is selected by hand, so the scraper keeps working when the layout changes.

Author
Alex Barlow
Published

Build the AI extraction from a description


Describe it and click the button: the agent builds and tests the AI scraper in your Chrome extension. You need a ChatGPT or Claude API key; see the ChatGPT integration.

  1. Open each URL in column A of my sheet
  2. Ask me which data the AI should extract
  3. Put the results in that URL's row from column B
Click to launch the Chrome extension. Not installed? You can create an account and try it free.Opens the Chrome extension. Free account to try.

You need a Google Sheet with one page URL per row in column A and nothing to its right: the values land in the same row from column B. Leave the sheet alone while the run writes to it.

Build the AI extraction step by step


The steps the agent builds, as the Builder shows them: each step by its name, with the fields to set under it. Add them yourself in this order in the step-by-step builder, or open the agent's result there to adjust it.

  • 1.0 Read data from a Google Sheet
    • Spreadsheet: your sheet
    • Sheet name: the tab with the URLs in column A
  • 2.0 Loop through data
    • repeats for every row in [google-sheet-data]
    • 2.1 Go to page
      • URL: column A of [google-sheet-data]
    • 2.2 Get data from bot's current page
      • Select: the outermost element holding what you want, or the custom selector body, with the data type Select HTML
    • 2.3 Integrate AI
      • API key: your key
      • Prompt: From this HTML, give me the values I asked for as comma-separated values, nothing else. naming the fields you chose, with [scrape-data] inserted
    • 2.4 Find row in a Google Sheet
      • Spreadsheet: your sheet
      • Sheet name: the same tab
      • Values (comma separated): column A of [google-sheet-data]
      • Exact match: on
    • 2.5 Write data to a Google Sheet
      • Spreadsheet: your sheet
      • Sheet name: the same tab
      • DATA: [ai-output]
      • Write options: Add to existing data
      • Starting cell: B[find-row-google-sheet], the found row from column B

Common questions about extracting data from HTML with AI


Why does the AI return prose or the wrong values?

The prompt leaves the AI room to guess. Tighten the prompt: name each value, give the order, ask for comma-separated values and nothing else. If the HTML is too large, select a smaller element in Get data from bot's current page instead of body.

Why does nothing reach the AI?

The prompt has no page data in it. Check the Integrate AI prompt contains [scrape-data], and that Get data from bot's current page found the element. When a run fails, hand it to the agent and it repairs the step.

Why extract data from HTML rather than the page text?

Markup keeps structure the text loses: which number is the price, which line is the address. For simple pages the visible text is enough and cheaper in tokens; see scrape any website with ChatGPT.

What does extracting data with AI cost compared with selectors?

A little more time and money: each page costs a model call. Use it for pages whose layout varies; for a fixed layout, selectors alone are faster, as in scrape every page in a list of links.

Can I extract data from HTML with AI without code?

Yes. Every step is a no-code step in the Chrome extension; the prompt is written in plain words, and no selector or script is needed.

Can I use Claude instead of ChatGPT to extract the data?

Yes. Integrate AI takes a ChatGPT or a Claude API key; the prompt and the rest of the automation are the same.

Can I run the AI extraction on a schedule?

Yes. Save the automation and set a schedule. Each run works through every URL in the sheet and writes beside it again, so remove the rows already filled, or move First cell on, before the next run.

Where do I get help?

Get in touch with support, or ask in the axiom.ai community.

Related guides