/docs/community?hl=en
/docs/community?hl=en
8/24/13
Original Poster
edfryed

How to extract the domain name from a URL?

I'm looking to extract the domain name from a URL. Here's an example of inputs and outputs I'm trying to achieve.

Example Inputs in a column A:
  1. google.com (or ideally 'productforums.google.com')
  2. seerinteractive.com
  3. hubspot.com (or ideally 'blog.hubspot.com')
Many thanks in advance!
Community content may not be verified or up-to-date. Learn more.
Recommended Answer
Was this answer helpful?
How can we improve it?
All Replies (3)
Chris Le
8/24/13
Chris Le
You can try using Seer's Toolbox. There's a function built in called "=getDomainName" which goes like this:

A2: =getDomainName(A1)

A2 will be example.com

You can also specify a range of cells if you're doing a column of URLs.

If you don't want the entire toolbox, you can also copy and paste the source code for just that function which is here: https://github.com/chrisle/seer.js/blob/master/build/seer.js#L1078


Chris Le
8/24/13
Chris Le
OOPS: Forgot to link to the Toolbox!
--Hyde
8/24/13
--Hyde
Hi,

To add to Chris' excellent contribution, to get the domain name using spreadsheet formulas, try something like this:

=regexextract(A2; "http://w*\.*([^/]+)")

The formula requires the URL to start with "http://" and is not as thorough as the getDomainName() custom function. It will strip an initial "www." if present.

To apply the formula to a whole column, try an array formula like this:

=arrayformula( iferror( regexextract(A2:A; "http://w*\.*([^/]+)") ) )

Thanks Chris for making the Toolbox available! It looks very good.

Cheers --Hyde

 
This question is locked and replying has been disabled. Still have questions? Ask the Help Community.

Badges

Some community members might have badges that indicate their identity or level of participation in a community.

 
Expert - Google Employee — Googler guides and community managers
 
Expert - Community Specialist — Google partners who share their expertise
 
Expert - Gold — Trusted members who are knowledgeable and active contributors
 
Expert - Platinum — Seasoned members who contribute beyond providing help through mentoring, creating content, and more
 
Expert - Alumni — Past members who are no longer active, but were previously recognized for their helpfulness
 
Expert - Silver — New members who are developing their product knowledge
Community content may not be verified or up-to-date. Learn more.

Levels

Member levels indicate a user's level of participation in a forum. The greater the participation, the higher the level. Everyone starts at level 1 and can rise to level 10. These activities can increase your level in a forum:

  • Post an answer.
  • Having your answer selected as the best answer.
  • Having your post rated as helpful.
  • Vote up a post.
  • Correctly mark a topic or post as abuse.

Having a post marked and removed as abuse will slow a user's advance in levels.

View profile in forum?

To view this member's profile, you need to leave the current Help page.

Report abuse in forum?

This comment originated in the Google Product Forum. To report abuse, you need to leave the current Help page.

Reply in forum?

This comment originated in the Google Product Forum. To reply, you need to leave the current Help page.