I was googling recently to see how to import SG stock price into Google Sheets, and found that it seems like we can’t really import the stock price from SGX website.
What I did found was that it was actually easier to track overseas US/HK/UK stocks prices using Google Sheets, compared to tracking stock prices in SGX or the Bursa.
Using GOOGLEFINANCE to track US Stock Prices
For US stocks price tracking, one can simply use GOOGLEFINANCE function found inside Google Sheets.
For example, if you want to track apple stock price, type =GOOGLEFINANCE(“AAPL”,”price”) into the cell.
Using IMPORTHTML to track US stocks
But what if you want to track more data like the dividends, PE and other financial ratios. I found that you can import the stock data found at Finviz.com into Google Sheets. See below for the stock information pertaining to Apple (AAPL). The stock price (bottom right), dividends, PE and other related financial ratios can be imported into Google Sheets.
So how to do this?
The first thing is to find the table. Through some trial and error, the table is table 8. From inputting the below into the cell, we are able to import all the financial data into Google Sheets. [B14 is the stock ticker for APPLE]
But this is not what we want. We want to find the market price, dividend etc. So we need to reference the relevant row and column to display the information required. For market price, it is at row 11 column 12. Dividends is at row 7 column 2. After entering
we can reference and import the stock price. The SUBSTITUTE function is to replace the asterisk * with blank.
Do note that the table may shift or disappear if the webpage changes layout.
Using GOOGLEFINACE to track HK/UK Stock Prices
For HK/UK stocks, we can use GOOGLEFINANCE function to get the price. If you want to track Alibaba, just type =GOOGLEFINANCE(“9988″,”price”) into the cell
Using IMPORTHTML to track SG stocks
The problem comes when i tried to use GOOGLEFINANCE for SGX stocks. I tried to use GOOGLEFINANCE(“Z74″,”price”) to get Singtel stock price. But it doesn’t work. Seems like Google is not unable to access SGX data or something.
The work-around is to use a similar method like for Finviz.com. I explored Yahoo Finance but the best I could get is the previous closing price, using the below formula
I was able to get the market price from Shareinvestor.com though, using the below formula.
While this may work at the time of this post, it may or may not continue to work in the future. So, please do take note. Also, I believe the method can also work for Bursa stocks.
You can find the above Tracking SGX portfolio Google Sheet here.
Hope you find these information useful. Thanks.