Toby Gibbs
Toby Gibbs

Reputation: 23

Extract Data From A URL Using Google Sheets

I am trying to extract data from a URL that is in a single cell in google sheets. The data in the cell is:

https://www.aliexpress.com/item/2017-SKMEI-Outdoor-Sports-Compass-Watches-Hiking-Men-Watch-Digital-LED-Electronic-Watch-Man-Sports-Watches/32790079639.html?spm=a2g01.8286187.3.1.3fa025c4ONMmXB&scm=1007.14594.99248.0&scm_id=1007.14594.99248.0&scm-url=1007.14594.99248.0&pvid=bff55205-e331-4c05-9e04-6e8c1a660f0f

From the URL I need to extract the number: 32790079639

Is there a way collecting this information?

Thanks!

Upvotes: 1

Views: 92

Answers (2)

Max Makhrov
Max Makhrov

Reputation: 18707

=REGEXEXTRACT(A1,"([^/]*)\.html")

A1 is text with your URL.

  • [^/]* -- any text, not /,
  • (...) -- to capture gruop

Upvotes: 1

bren
bren

Reputation: 4334

You can use the function =REGEXEXTRACT to achieve this goal. This function uses a regular expression to extract a substring from the input. For example,

=REGEXEXTRACT(A1, "([0-9]+)\.html")

A full example here

Upvotes: 1

Related Questions