Scrape any part of a webpage using the XPath.

Check this article on how to scrape web pages using XPath.

Basically, if you click on the element that you want to scrape, right click > inspect element then a sidebar will appear. Right click on the HTML element that you've inspected and click on Copy > Copy Xpath.

That's it! You'll have the XPath copied in your clipboard

Credits cost per execution

This function spends 1 credit per execution

Video example


  • url: The URL you want to scrape (i.e.

  • scrapeSeveralElements: Set to True if you want to scrape several elements. For default is set to False so it will scrape only the first element

  • xPath: The xpath to select the element you want to scrape (i.e. //div[@id="id"])

  • method The method to use to get the element (i.e. getText).

Expected output

  • string: The element you want to scrape

Text example

scrapeByXPath("", TRUE, "//h2", "getText")
// seo-scraper
// Installing
// Get started with default config
// Custom Configuration
// Custom scraping example
// Transformers
// Keywords

Use cases

  • Scrape any website from Google Sheets

Last updated