taviso / 123elf

A native port of Lotus 1-2-3 to Linux.
1.18k stars 59 forks source link

GoogleFinance() #129

Closed jarkkojs closed 3 months ago

jarkkojs commented 3 months ago

One feature that I love in Google Sheets is GoogleFinance(). I wonder how feasible it would be to have that function also in this program. I've done e.g. my tax reports using that function. It would be cool if I could write e.g. my tax report with this software, then upload to the Google Drive and look up to it later with the Sheets.

I guess to access whatever service GoogleFinance() is using to be authenticated to Google services using probably Oauth2 token?

taviso commented 3 months ago

There is @SYSTEM(), so I use things like @VALUE(@SYSTEM("stocks.sh GOOGL"))*A3 to get stock prices.

And you don't have to hardcode things, you can do @VALUE(@SYSTEM("stocks.sh " & A6)) (where A6 contains a ticker symbol)

stocks.sh is just a quick shellscript that does:

curl -s "https://www.google.com/finance/quote/${symbol}${exchange}" | htmlq --attribute data-last-price 'div[data-last-price]'
jarkkojs commented 3 months ago

Wow that does it for me :-) Thank you!