Update, 2023-12-15: investing.com rendering is super unstable – I’ve resorted to using ishares.com directly. The new snippet for CHSPI:
=SUBSTITUTE(importxml("https://www.ishares.com/ch/individual/en/products/264107/ishares-spi-ch-fund","//*[@id='fundheaderTabs']/div/div/div/ul/li[1]/span[2]"), "CHF ", "")
Update, 2023-06-19: investing.com has changed some of its html. The new snippet for CHSPI:
=importxml("https://www.investing.com/etfs/ishares-core-spi","//*[@id='__next']/div[2]/div[2]/div/div[1]/div/div[1]/div[3]/div/div[1]/div[1]")
As we all know, Google Finance and ETF (at least ishares) import* in Google Spreadsheets has been broken since December 2022:
https://issuetracker.google.com/issues/262157479
So if you use =GOOGLEFINANCE("CHSPI","price"), in your spreadsheet, all you’ll get is the following error message:
Error:
When evaluating GOOGLEFINANCE,
the query for the symbol: 'CHSPI' returned no data.
Since we all also know, Google Finance isn’t the fastest in fixing bugs (as evidenced by this bug, but also several others prior to this one), and their feeds (latency,..) are best-effort-at-best.
To fix this in your spreadsheet, head over to investing.com, enter whatever stock/currency/etf/.. you want to import data from, copy the url and use that combined with importxml:
Say you’re looking for SWX:CHSPI:
- Go to investing.com, enter CHSPI, click on the search result.
- This takes you to https://www.investing.com/etfs/ishares-core-spi, where you’ll copy the url ("website address").
- Open your spreadsheet, head to the cell you like most, enter:
=importxml("https://www.investing.com/etfs/ishares-core-spi","//*[@data-test='instrument-price-last']") to get the latest price. - Silently thank investing.com
* Note that not only importing in spreadsheets (using =googlefinance) is broken – none of the symbols show up on Google Finance itself either.