0
votes

I need to use Google Spreadsheet ImportXML return a value from this website...

http://www.e-go.com.au/calculatorAPI2?pickuppostcode=2000&pickupsuburb=SYDNEY+CITY&deliverypostcode=4000&deliverysuburb=BRISBANE&type=Carton&width=40&height=35&depth=65&weight=2&items=3

the website simply displays the below in text and code...

error=OK
eta=Overnight
price=64.69

I need to return the values after last line 'price=', being a newbee I'm struggling with xpath query (?) required to make this happens...

=importxml("url",?)

Your help is greatly appreciated.

Thank you in advance.

Regards

1

1 Answers

1
votes

first of all, IMPORTXML() won't work because your webpage is not formatted correctly for XML, and google sheets doesn't like it.

All hope is not lost tho, as your output is so simple. you can simply load the whole output using IMPORTDATA() and then process within google sheets

have a look at the output of the following formulae (where the url is stored in A1)
=IMPORTDATA(A1)

=transpose(IMPORTDATA(A1))

=index(IMPORTDATA(A1),3,1) - IF there are always 3 results, and price will always be in the third one this will work

=filter(IMPORTDATA(A1),left(IMPORTDATA(A1),5)="price") - if the price can appear in any of the result lines, but always starting with "price"