A compiled and ready-to-install version of this extension is available at the LibreOffice Extension Center.
Currently the SMF Extension supports retrieving data from Morningstar and Yahoo Finance. I hope that providing the code openly will allow others, who may have the time or skill, to implement additional functionality.
The SMF Extension adds three new functions to Calc. These functions can be used as follows:
=GETYAHOO(Ticker,Datacode)
=GETMORNINGKEY(Ticker,Datacode)
=GETMORNINGFIN(Ticker,Datacode)
Where Ticker is the standard symbol ex. AAPL and Datacode is the data element desired.
Quotes MUST be used when entering the ticker symbol directly into the function:
=GETYAHOO("AAPL",1)
But are not needed when referencing another cell:
=GETYAHOO(A1,1)
In the latter case the data in A1 should be AAPL not "AAPL"
The full code lists are demonstrated in individual spreadsheets found in the /examples directory
NOTE: These files call the new functions many times and may be slow to load depending on your internet connection and computer hardware. Please be patient.
-
For historical company financial data: The SEC's EDGAR Database
Use of the XBRL markup looks like a promising avenue for more recent (~5yr) filings. Outside that may require some serious regex muscle. -
For current and historical market data: The NASDAQ Database
-
There are many other sites such as ADVFN, Finviz, and Marketwatch that provide useful data.
The SMF extension is written in Python. Thanks to Corey Goldberg's ystockquote for inspiration with the Yahoo portion of the SMF Extension.