| Author |
Message |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 26/01/2009 13:06:59
|
russau
Joined: 26/01/2009 12:44:48
Messages: 14
Offline
|
Here's a really nice feature of the spreadsheet in Google Docs. The "IMPORTXML" feature can grab XML from a URL. Which means you can perform queries against the GeoNames foums from within a google docs spreadsheet.
For example, paste this into a spreadsheet cell:
=IMPORTXML("http://ws.geonames.org/search?q=Sydney&maxRows=1&style=FULL", "/geonames/geoname[1]/timezone")
This will grab the xml at "http://ws.geonames.org/search?q=Sydney&maxRows=1&style=FULL", and use the XPATH query in the second parameter to grab the timezone.
The becomes a lot more useful when combined with a CONCATENATE function. Try this, paste three cities into cells A1-A3: "Sydney, Paris, Damascus". In B1 paste in a function to get the timezone for the city in cell A1:
=IMPORTXML(CONCATENATE("http://ws.geonames.org/search?q=",A1,"&maxRows=1&style=FULL"), "/geonames/geoname[1]/timezone")
..and you get the timezone. Now drag the formula down to the next two cells to get all the timezones. Nice!
Hopefully the Geonames webservice can handle everyone playing around with this feature. Note: google docs limits you to 50 IMPORTXML queries per spreadsheet : http://documents.google.com/support/bin/answer.py?hl=en&answer=75507 .
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 26/01/2009 21:51:47
|
marc
Joined: 08/12/2005 07:39:47
Messages: 4501
Offline
|
Thanks for sharing this tip with us.
Marc
|
 |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 02/12/2009 14:16:38
|
sahertian
Joined: 30/11/2009 09:43:22
Messages: 10
Offline
|
Hi Russau,
Sure this works?? It gives me a parse error!!!
Thanks,
Ron
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 03/12/2009 11:52:40
|
russau
Joined: 26/01/2009 12:44:48
Messages: 14
Offline
|
I just tried it again, and it works fine. Did you definitely copy/paste the full IMPORTXML function?
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 03/12/2009 12:02:55
|
sahertian
Joined: 30/11/2009 09:43:22
Messages: 10
Offline
|
Yes, did a paste in a spreadsheetcel...
=IMPORTXML("http://ws.geonames.org/search?q=Sydney&maxRows=1&style=FULL", "/geonames/geoname[1]/timezone")
thanks,
Ron
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 03/12/2009 12:06:13
|
sahertian
Joined: 30/11/2009 09:43:22
Messages: 10
Offline
|
This is the link..
https://spreadsheets.google.com/ccc?key=0Aq4-NxQ0NzNDdENHa3hyY1pEZjlvM0dsRDRnRHRpUVE&hl=nl
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 03/12/2009 14:40:25
|
sahertian
Joined: 30/11/2009 09:43:22
Messages: 10
Offline
|
Works now...
It has to do with the default language for the spreadsheet. Changed it from Dutch to US.
Thanks..
|
|
|
 |
|
|