Importxml Google spreadsheet "formula parse error" - xpath

I'm trying to import a value from XML into Google spreadsheet with:
=IMPORTXML("https://waterservices.usgs.gov/nwis/iv/?format=waterml,2.0&indent=on&sites=04214231&parameterCd=00060,00065&siteStatus=all", "//*[#id="collapsible25"]/div[1]/div[2]/div[2]/span[2]")
But I'm receiving:
Formula parse error
The specific data I am trying to import is 3.97 in the node <wml2:value>3.97</wml2:value>.

on the xPath parameter, replace " by '. This is because " are used in Google Sheets formulas as text value delimiters.
Other questions with similar problems:
Google Spreadsheet xPath
Google Sheets IMPORTXML XPath Query

Related

Get synonyms of a word from Thesaurus using Google Sheets importxml function

I am trying to make a dictionary that includes one synonym for each word on Google Sheets. I wish that I can get only first synonym on the Thesaurus search result page, by copying XPath and pasting it to the importxml function. Could anybody help me getting the entire function that I can apply to all of my words? (hundreds of words so I need automation).
You can use something like this (first we concat to generate the url, then we pass the XPath expression :
=IMPORTXML("https://www.thesaurus.com/browse/"&B2;"(//h2)[1]/following::li[1]//text()")
Output :
EDIT : To get 3 synonyms in one cell, use :
=TEXTJOIN(";";VRAI;IMPORTXML("https://www.thesaurus.com/browse/"&B2;"(//h2)[1]/following::li[position()<4]//text()"))
Output :

How to webscrape deeply nested XML?

I'm trying to scrape XML data into Google Sheets using the importxml function. I previously tried using the importhtml function, but the "list" and "table" query you need to use doesn't work.
I can't seem to work out the correct way to scrape the "Price (GBX)" value in a simple Market Data webpage, such as https://markets.ft.com/data/equities/tearsheet/summary?s=LSE:LSE
I have tried to use search by div, span and class name but am not getting anywhere.
I have also tried to copy the XPath /html/body/div[3]/div[2]/section[1]/div/div/div[1]/div[3]/ul/li[1]/span[2]
but this doesn't seem to work
Is it possible to retrieve data that is very nested through XML scraping in Google Sheets?
Try using
=IMPORTXML(A1,"//ul/li/span[#class='mod-ui-data-list__label'][contains(text(),'GBX')]/following-sibling::span")
Output:
7576.00

Official reference for Google Spreadsheet Api Structured Query syntax

I'm looking for the official reference for the query syntax used for creating structured queries for requesting rows in the Google Spreadsheet API, as discussed here
The only example given is:
GET https://spreadsheets.google.com/feeds/list/key/worksheetId/private/full?sq=age>25%20and%20height<175
There must be some references of the query syntax used somewhere?
In particular I want to know how to query for all rows (containing column a and b) for which val(a) != val(b)

google place api Incorrect Results

Hi I have a problem with displaying the results of a google place api
When I write nightclub Google search I get results that match my search
But when I search through google place api I get the results is not so correct as Bookstore, apartments for rent and other results not so related
The URL looks like this
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=32.0768214,34.8147987&radius=5000&keyword=Nightclub&sensor=true&language=en&key=MyKey
Thank you!
As the docs state:
keyword — A term to be matched against all content that Google has indexed for this Place, including but not limited to name, type, and address, as well as customer reviews and other third-party content.
So that filter isn't going to be quite as specific as you would like. If you only want to get night clubs, you can use the types param with a value of night_club. See Supported Place Types for all of the other possible values.

Google Analytics filter to combine /home.aspx and /

the following urls are the same page, I'd like it to be recognized as the same page in Google Analytics. What filter do I create so it's not replicated?
/contact/home.aspx
&
/contact/
A simple search and replace filter should do that for you:
create a new filter > search and replace
select the filter field Request URI
in the search string field /contact/home\.aspx
in the replace string field add /contact/
Screenshot:

Resources