+ Reply to Thread
Results 1 to 2 of 2

[Google Docs/Sheets] Redirect checker / statuscode

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    netherlands
    MS-Off Ver
    Excel 2003
    Posts
    1

    [Google Docs/Sheets] Redirect checker / statuscode

    So I stumbled across this code on the internet.
    It let's you check the statuscode and redirect url for the given URL in Google Sheets. Unfortunately the script doesn't return the final url or the final statuscode. So If I have a url that consists of 5 redirects, the script only shows the error and url of the first redirect url.

    I was wondering if it's possible in Google Sheets to show all urls of a redirect chain, especially the final redirect url. If an url has 5 direct then it will show 5 different links. Example
    I know it's possible within Excel with VBA (click for script), but don't have a clue how to reproduce it in Google Sheets

    Hope someone can give me some directions to accomplish this in Google sheets



    PHP Code: 
    function statuscode(urluserpwd) {
        try {
            var 
    response UrlFetchApp.fetch(url, {
                
    muteHttpExceptionstrue,
                
    followRedirectsfalse,
                
    headers: {
                    
    'Authorization''Basic ' Utilities.base64Encode(user+':'+pwd)
                }
            });
            return 
    response.getResponseCode();
        } catch (
    error) {
            
            return 
    "Error";
        }
    }



    function 
    location(urluserpwd) {
        try {
            var 
    response UrlFetchApp.fetch(url, {
                
    muteHttpExceptionstrue,
                
    followRedirectsfalse,
                
    headers: {
                    
    'Authorization''Basic ' Utilities.base64Encode(user+':'+pwd)
                }
            });
            
    header response.getHeaders();
            
    location header['Location'];
            return 
    location;
        } catch (
    error) {
            return 
    "Error";
        }


  2. #2
    Registered User
    Join Date
    05-23-2011
    Location
    Kentucky
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: [Google Docs/Sheets] Redirect checker / statuscode

    bump. same question here

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Import from Google Docs
    By www.vyuka-excelu.cz in forum Excel General
    Replies: 0
    Last Post: 07-22-2015, 11:30 AM
  2. Creating multiple password protected sheets on google docs for a group of people
    By Navin Agrawal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2014, 04:00 AM
  3. pull certain data from google docs form-produced spreadsheet to other docs
    By MisterCadillac in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 03-11-2014, 04:49 AM
  4. Google Docs - Alternative to SUMIFS
    By jayooo in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 7
    Last Post: 06-10-2013, 05:20 PM
  5. countifs in google docs
    By lolpopo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-09-2013, 09:21 PM
  6. read a value from google docs
    By ahmed471 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2012, 05:07 PM
  7. Google Docs
    By ianh in forum The Water Cooler
    Replies: 2
    Last Post: 06-11-2011, 02:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1