Quick overview
This workflow runs daily, reads business-directory page URLs from Google Sheets, captures fully rendered HTML via Snapshot Site, uses OpenAI (via n8n’s Information Extractor) to extract structured business listings, and writes results back to Google Sheets while logging extraction errors.
How it works
- Runs every day at 12 PM on a schedule trigger.
- Reads directory listing page URLs from the “Directory Sources” tab in Google Sheets and processes them one at a time.
- Fetches the fully rendered HTML for each URL using Snapshot Site and routes any API errors to an error log flow.
- Cleans the captured HTML by removing scripts/styles and trimming the content before extraction.
- Sends the cleaned HTML to OpenAI through the Information Extractor to return an array of structured business records.
- Splits the extracted businesses into individual rows and appends or updates them in the “Businesses” tab in Google Sheets, deduplicating by directoryUrl.
- Appends any capture/extraction failures to the “Extraction Errors” tab in Google Sheets and continues processing the remaining URLs.
Setup
- Install the community node
n8n-nodes-snapshot-site and add Snapshot Site credentials.
- Connect Google Sheets credentials and set the target spreadsheet URL/ID for the read, results, and error tabs.
- Add an OpenAI (Chat Model) credential and select the model used by the Information Extractor.
- Create the Google Sheets tabs “Directory Sources”, “Businesses”, and “Extraction Errors”, ensuring “Directory Sources” includes a
url column and the other tabs have headers matching the extracted fields.
- Confirm the “Save Businesses” node matches on
directoryUrl (or update the matching column) and adjust the daily schedule time if needed.