Un-Shorten URL

Nanogirl21

Active Member
Joined
Nov 19, 2013
Messages
265
I have about 3,000 shorten URLS. They was converted using Goo.Gl by someone else. Is there a way in Excel that I can unshorten these URLS and populate the full link in a new cell? Cell A2, A3, A4 ect is where I would like to put the new full URL. There is a website (Unshorten any URL - unshort.me) that allows you to unshorten URLS. It’s a pain to go through 3,000 URLS and copying them over to and from the website manually. Is there a way to do this in excel? Macro maybe?

Here are two URL's for example.
http://goo.gl/QIp7xJ
http://goo.gl/Hga4Dw

<colgroup><col></colgroup><tbody>
</tbody>


Thank you.
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Kyle123

Well-known Member
Joined
Jan 24, 2012
Messages
2,702
I reckon this'll get you most of them (put it in a standard module):
Code:
Public Function unshorten(url As String) As String
    
    Static oRequest As Object
    
    Set oRequest = CreateObject("WinHTTP.WinHTTPRequest.5.1")
    
    With oRequest
        .option(6) = True
        .option(12) = True
        .Open "HEAD", url, False
        .send
        unshorten = .option(1)
    End With
    
End Function
It's then used as a worksheet function:
Code:
=Unshorten(A1)
 

Nanogirl21

Active Member
Joined
Nov 19, 2013
Messages
265
I reckon this'll get you most of them (put it in a standard module):
Code:
Public Function unshorten(url As String) As String
    
    Static oRequest As Object
    
    Set oRequest = CreateObject("WinHTTP.WinHTTPRequest.5.1")
    
    With oRequest
        .option(6) = True
        .option(12) = True
        .Open "HEAD", url, False
        .send
        unshorten = .option(1)
    End With
    
End Function
It's then used as a worksheet function:
Code:
=Unshorten(A1)
That worked perfectly! Thank you very much.
 

Watch MrExcel Video

Forum statistics

Threads
1,096,187
Messages
5,448,860
Members
405,534
Latest member
paddybear

This Week's Hot Topics

Top