Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Excel is it possible to have a list of URLs in column A and have a column B auto-populate with the URL of the page you get to if you click the link in Column A.

(I would like to audit all the 301/302 redirects currently on one of my sites)

share|improve this question
Excel is not the tool for this. You want something like curl $1 -s -L -I -o /dev/null -w '%{url_effective}' – Darth Android May 20 '13 at 15:28

Linux will be a big help here:

Create a script file called fetch_redirects:

while read url
    echo -n "$url,"
    curl "$url" -s -L -I -o /dev/null -w '%{url_effective}'
done < "${1:-/proc/${$}/fd/0}"

Make sure to mark it executable

Then, given a list of urls, one per line in urls.txt, execute:

cat urls.txt | fetch_redirects > redirects.csv

You can then open redirects.csv in Excel or any other tool which supports CSV files.

share|improve this answer
An equivalent batch solution using curl.exe can also be cooked up of course if required. – Karan May 20 '13 at 15:48
@Karan By all means please edit it into the answer beside the bash script! :) I'm just not as well versed in batch scripting. >.< – Darth Android May 20 '13 at 15:50
Might do so later, although going by the recent edit above looks like the OP would prefer a VBScript/VBA solution. – Karan May 20 '13 at 15:53
Yes please Karen. – MarkP May 20 '13 at 15:58
I've found the following which checks to see if a URL exists (i.e. looking for a status code of 200) Function HttpExists(sURL As String) As String Dim oXHTTP As Object Set oXHTTP = CreateObject("MSXML2.XMLHTTP") If Not UCase(sURL) Like "HTTP:*" Then sURL = "http://" & sURL End If On Error GoTo haveError oXHTTP.Open "HEAD", sURL, False oXHTTP.send HttpExists = IIf(oXHTTP.Status = 200, "Page is Live", "redirects or missing") Exit Function haveError: HttpExists = "redirects or missing" End Function – MarkP May 20 '13 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .