+ Reply to Thread
Results 1 to 21 of 21

Google Drive time

  1. #1
    Registered User
    Join Date
    12-07-2011
    Location
    Ontario
    MS-Off Ver
    Excel 2003
    Posts
    20

    Google Drive time

    Good day all, I have (via this forum) found and customized a macro that will give me Time and distances between 2 cities. This was working perfectly until today when I opened up the spread sheet to use it and now I am getting this error

    Runtime error '13'
    Type Mismatch

    I have figured out that (I believe) I am not getting anything returned from

    TgetGoogDistanceTime = CDbl(Left(TgetGoogDistanceTime, InStr(1, TgetGoogDistanceTime, " ") - 1))

    as it shows me TgetGoogDistanceTime = 'NOT FOUND'

    The same goes with VgetGoogDistanceTime


    Please Login or Register  to view this content.

    I am in no way an expert so some hand-holding is required, but I would like to say Thank you in advance for your help!

  2. #2
    Registered User
    Join Date
    12-15-2011
    Location
    South Yorkshire
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Google Drive time

    This might help - Its over my head

    BTW there another Thread here

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Google Drive time

    Try giving this a go, be aware though that google set a daily maximum number of calls that can be made:

    EDIT: I've removed this as after reading the documentation for the API, using it in this way breaks the terms of use
    Last edited by Kyle123; 12-16-2011 at 10:20 AM.

  4. #4
    Registered User
    Join Date
    12-15-2011
    Location
    South Yorkshire
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Google Drive time

    thanks Kyle123! this works for Travel Time, is it possible to modify code to also calculate miles?

    thanks agian

    Col

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Google Drive time

    Yep, that's what I wrote it for and modified it for the above:

    EDIT: I've removed this as after reading the documentation for the API, using it in this way breaks the terms of use
    Last edited by Kyle123; 12-16-2011 at 10:20 AM.

  6. #6
    Registered User
    Join Date
    12-15-2011
    Location
    South Yorkshire
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Google Drive time

    Thanks Again! amazing! its works but its in Kilometres can I change this to Miles by changing the code or should I just create another column to divide by 0.621371192?

  7. #7
    Registered User
    Join Date
    12-15-2011
    Location
    South Yorkshire
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Google Drive time

    I have attempted to add &units=imperial to your code but returns VALUE

  8. #8
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Google Drive time

    yes, with a bit of fiddling. The code is below though I haven't tested it extensively, I think it should work though an additional column/function would be more resilient, i.e
    PHP Code: 
    =(GetDistance(x,y,z))*0.621371192 
    Google only returns distance as metres although you can force the text to be in miles ("169 mi"), you then need to parse this out:

    EDIT: I've removed this as after reading the documentation for the API, using it in this way breaks the terms of use
    Last edited by Kyle123; 12-16-2011 at 10:21 AM.

  9. #9
    Registered User
    Join Date
    12-15-2011
    Location
    South Yorkshire
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Google Drive time

    Thanks again!! I will use =(GetDistance(x,y,z))*0.621371192 method. Note that for some reason that I don't understand divide returns incorrect number but * returns correct number

  10. #10
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Google Drive time

    Because dividing by a smaller number that 1 increases the value

  11. #11
    Registered User
    Join Date
    12-07-2011
    Location
    Ontario
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Google Drive time

    Thanks, maybe I am missing something here but where do I put it?

    I thought it replaced
    Please Login or Register  to view this content.
    But I am getting a Compile error sub or sub function no defined on Gethtml

  12. #12
    Registered User
    Join Date
    04-29-2011
    Location
    islip, ny
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Google Drive time

    Is this rounding for anyone else? All of my results are rounded and I'm looking for results accurate to tenth of mile...? Thanks in advance

  13. #13
    Registered User
    Join Date
    12-15-2011
    Location
    Tiverton, Devon
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Google Drive time

    Hi

    Not sure if it's just me, but it's not working. Keep getting an subscript out of range issue? Any ideas? On the following line:

    temp = (Split(Replace(Filter(Split(Replace("~" & .DocumentElement.XML, "</distance>", "<distance>~"), "<distance>"), "~", False)(0), "<text>", "</text>"), "</text>")(1))

    Thanks

  14. #14
    Registered User
    Join Date
    04-29-2011
    Location
    islip, ny
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Google Drive time

    Edit: Ugh, never mind. I thought I had an answer to your question.

  15. #15
    Registered User
    Join Date
    12-15-2011
    Location
    Tiverton, Devon
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Google Drive time

    It's ok, I've tracked it down to an OVER_QUERY_LIMIT due to Google's 2500 limit on use per day.

    I'll give it another go later.

  16. #16
    Registered User
    Join Date
    05-05-2010
    Location
    Maidenhead, England
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Google Drive time

    Darn it Looks like I missed the working code

    Does anyone have an alternative solution?

    Thanks
    Paul

  17. #17
    Registered User
    Join Date
    04-29-2011
    Location
    islip, ny
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Google Drive time

    Quote Originally Posted by Kyle123 View Post
    EDIT: I've removed this as after reading the documentation for the API, using it in this way breaks the terms of use
    I'm looking at the terms of use/service agreement now; I'm curious where this violates it? I'm not that legally savvy.

    I see a portion that says no access outside of the service and I'm going to assume that this is what you are referring to but isn't the service the API to begin with?

    You may not access the service without accessing the service.... :O
    Last edited by tomn13; 12-28-2011 at 09:30 AM.

  18. #18
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Google Drive time

    I'm referring to this bit:
    Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
    Since we are only using the service to get distances within excel

  19. #19
    Registered User
    Join Date
    04-29-2011
    Location
    islip, ny
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Google Drive time

    Interesting; ok thanks. That makes sense to me now.

    Sheesh.

  20. #20
    Registered User
    Join Date
    05-05-2010
    Location
    Maidenhead, England
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Google Drive time

    The original method didnt use the api, just a normal web query to maps.google.co.uk, so could we use that instead without breaking the terms?

  21. #21
    Registered User
    Join Date
    04-29-2011
    Location
    islip, ny
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Google Drive time

    Correct it didn't use the API -- from what I can gather about web queries it would parse source code of the site to look for information. *I BELIEVE* (Since I still don't 100% understand this to this day) that Google changed the website source code to STOP putting in destination travel times and distances in the source code. It somehow references it... somehow... from something without being hard coded. And without it being hard coded it can't be parsed.

    I'm pretty sure I'm correct about that: I started another thread about finding alternate ways to get distance as located here: http://www.excelforum.com/excel-gene...t-google.html?

    But people tend to ignore my threads and make new ones and get responses. So it should be only a matter of time until someone repeats the same question and the conversation takes off like a horse at the track

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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