1

I'm trying to input data based on column "A" into column "B". If "A" is a comprehensive list of website urls, would it be possible to run a script that scrapes the phone numbers, for example, from these websites and inputs into column "B"?

I am 100% newbie to scripting, but would love to learn how this works.

1 Answer 1

2

Assuming each cell in Column A is one url, you definitely can scrape for phone numbers.

enter image description here

The code to achieve this:

  • Extract the webpage's text (assuming the phone number isn't structured as a link or something else).
  • Search that text for phone numbers using regex.
B2: =JOIN("|",IMPORTXML(A2,"//a/@href"))
C2: =REGEXEXTRACT(B2,"[0-9]{3}[- ]*[0-9]{3}[- ]*[0-9]{4}")
Sign up to request clarification or add additional context in comments.

2 Comments

thank you for the response! IMPORTXML doesn't pull any of the content of the page, and won't let me then search for the phone number in C2.
What's the URL you're using? (It could have some protection against bots...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.