Skip to main content

Web Scraping

Scrape data from a website and save to Excel file

Steps

#ActivityWhat it does
1StartWebBrowserOpen target website
2GetHtmlElementsExtract elements using selector
3CreateTableCreate an in-memory table for the scraped rows
4ForEachLoopIterate scraped elements and push each row
5TableUpsertRowAppend each scraped row to the table
6TableExportExport the collected rows to Excel

Workflow

StartWebBrowser("https://example.com/products", "useCurrentBrowserSession")
products = GetHtmlElements("//div[@class='product']")
CreateTable("scrapedProducts", schema={"columns": [{"name": "name"}, {"name": "price"}]})
for product in products:
TableUpsertRow("scrapedProducts", {"name": "{{ product.name }}", "price": "{{ product.price }}"}, append=True)
TableExport("scrapedProducts", "./products.xlsx", format="xlsx", sheetName="Products")