🎣 Enrich company data from Google Sheet with OpenAI Agent and ScrapingBee

⚡ 9,554 views · 🎣 Lead Generation & Enrichment

💡 Pro Tip — HTTP Request scraping tends to break when sites update their markup. If you’re scraping a major platform, check if ScraperNode covers it — it has maintained scrapers for LinkedIn, Instagram, TikTok, YouTube, and 20+ other platforms that return structured data.

View All Scrapers

Description

This workflow demonstrates how to enrich data from a list of companies in a spreadsheet. While this workflow is production-ready if all steps are followed, adding error handling would enhance its robustness.

Important notes

Main Workflow

Node 1 - Webhook

This node triggers the workflow via a webhook call. You can replace it with any other trigger of your choice, such as form submission, a new row added in Google Sheets, or a manual trigger.

Node 2 - Get Rows from Google Sheet

This node retrieves the list of companies from your spreadsheet. here is the Google Sheet Template you can use. The columns in this Google Sheet are:

Node 3 - Loop Over Items

This node ensures that, in subsequent steps, the website in “extra workflow input” corresponds to the row being processed. You can delete this node, but you’ll need to ensure that the “query” sent to the scraping workflow corresponds to the website of the specific company being scraped (rather than just the first row).

Node 4 - AI Agent

This AI agent is configured with a prompt to extract data from the content it receives. The node has three sub-nodes:

Node 5 - Update Company Row in Google Sheet

This node updates the specific company’s row in Google Sheets with the enriched data.

Scraper Agent Workflow

Node 1 - Tool Called from Agent

This is the trigger for when the AI Agent calls the Scraper. A query is sent with:

Node 2 - Set Company URL

This node renames a field, which may seem trivial but is useful for performing transformations on data received from the AI Agent.

Node 3 - ScrapingBee: Scrape Company's Website

This node scrapes data from the URL provided using ScrapingBee. You can use any scraper of your choice, but ScrapingBee is recommended, as it allows you to configure scraper behavior directly. Once configured, copy the provided “curl” command and import it into n8n.

Node 4 - HTML to Markdown

This node converts the scraped HTML data to Markdown, which is then sent to OpenAI. The Markdown format generally uses fewer tokens than HTML.

Improving the Workflow

It’s always a pleasure to share workflows, but creators sometimes want to keep some magic to themselves ✨. Here are some ways you can enhance this workflow:

đź”— Nodes Used

Google Sheets, HTTP Request, Webhook, Markdown, Execute Workflow Trigger, AI Agent

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup