Skip to content

Any website

Not every site is a featured platform with dedicated selectors. For everything else, WebToSheets gives you a set of generic selectors that work on any site, plus XPath whenever you need to target something specific.

lightbulb
You don't need to write any of this by hand. Paste the page's link into the sidebar's Formula Builder and WebToSheets offers these fields automatically.
When no platform is featured, paste any link, tick a field, and insert it.

Choosing a generic selector

You may pass any of these selectors as the second argument. List selectors such as emails or linkAnchors return a column of values; add /N where noted to grab a single item:

Field Selector Example value
Page title The page title from the <title> tag title Welcome to Example.com
Heading 1 All H1 heading elements h1 Main heading
Heading 2 All H2 heading elements h2 A section heading
Heading 3 All H3 heading elements h3 A sub-heading
Paragraphs All paragraph text on the page p Lorem ipsum dolor…
Table Table data. Use table/2 for the second table, etc. table + /N table/2
Link URLs All link URLs (href attributes) linkUrls https://example.com/page
Link text All link anchor text linkAnchors Learn more
Email addresses Email addresses from mailto links and text content emails contact@example.com
Image URLs All image source URLs imageSources https://example.com/a.jpg
Image alt text All image alt text imageAlternatives Product photo
Heading 4 All H4 heading elements h4 A minor heading
Heading 5 All H5 heading elements h5
Heading 6 All H6 heading elements h6
Div blocks Text of all div elements div Section content
Spans Text of all span elements span Inline text
Meta title Meta title content metaTitle Example — Home
Meta description Meta description content metaDescription An example website…
Meta keywords Meta keywords content metaKeywords example, web, demo
Twitter handle Twitter meta tag content metaTwitter @examplesite

Using XPath for anything else

Any selector starting with / is treated as an XPath expression and evaluated against the page. This is the most precise way to target an element when no named selector fits, and both elements and attributes are supported. For example, you may match a price element or read an attribute directly:

=SCRAPE("https://example.com", "//span[class=""='price']")
=SCRAPE("https://example.com", "//a/@href")

For a quick way to grab an XPath straight from your browser, see how to find the right selector.

Example

Let's pull every email and every link from a contact page in a single call:

=SCRAPE("https://example.com/contact", "emails,linkUrls")

As you can see, WebToSheets "spills" each match onto its own row, so the emails and links land side by side:

leads — Google Sheets
A
B
1
| sales@example.com
example.com/about
2
support@example.com
example.com/pricing
fx

Still stuck?

We usually reply within 24 hours on business days.

Contact support arrow_forward