Excel distance calculation by using Google Maps API key

和自甴很熟 提交于 2020-01-06 04:43:27

问题


I have been using this for couple of months without a problem. Now I am getting #VALUE in Excel all the time I try get the distance. What can be the problem?

I have Google Maps KEY AIzaS.....I

Request URL https://maps.googleapis.com/maps/api/distancematrix/xml?origins=$1&destinations=$2&mode=$3&key=$k

C8 = London, C9 = Manchester, C10 = Driving

Formula in C13: =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(gmaps.distance.url;"$1";SUBSTITUTE(C8;" ";"+"));"$2";SUBSTITUTE(C9;" ";"+"));"$3";gmaps.travel.mode);"$k";gmaps.key)

Response in C15: =WEBSERVICE(C13) ERROR #VALUE

Status in C16: =FILTERXML(C15;"//status[1]") ERROR #VALUE

Distance in C18: =FILTERXML(C15;"//distance[1]/text") ERROR #VALUE

Travel Time in C19: =FILTERXML(C15;"//duration[1]/text") ERROR #VALUE

If I copy-paste to my browser generated link in C13 I get data below on opened page. So API key and link working? Is there something wrong in =WEBSERVICE(C13) formula?

I have tried to use =WEBSERVICE("GENERATED LINK IN C13") with no success. Getting #VALUE as well.

While copy-pasting link from C13 to internet browser:

<DistanceMatrixResponse>
<status>OK</status>
<origin_address>London, UK</origin_address>
<destination_address>Manchester, UK</destination_address>
<row>
<element>
<status>OK</status>
<duration>
<value>14735</value>
<text>4 hours 6 mins</text>
</duration>
<distance>
<value>335534</value>
<text>336 km</text>
</distance>
</element>
</row>
</DistanceMatrixResponse>

来源:https://stackoverflow.com/questions/53959061/excel-distance-calculation-by-using-google-maps-api-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!