Google Sheets API

This is a long shot…but wondering if anyone has had any experience with the Google Sheets API.

I would like to dynamically plot a line chart, by taking data from a cell (the value of my holdings) on a 24hrs basis, putting that data into hidden sheet.

the plotting a graph with that data on another sheet.

Anyone know if that is possible of has done something similar?

You should be able to do this using “Time-driven (clock)” Triggers and with App scripts. Just be careful, as they charge for this on a per-use basis, although for 365 runs a year it should be free or negligible.

Thanks @saf ill take a look.

Stuff like this could be decent if FT released an API or just a web version :slight_smile: with more detail than the app…

I’ve previously done exactly this with a script. The portfolio value got calculated from the list of holdings and then then script recorded the portfolio value in a new row every day at 11 pm then you can plot the numbers. I still have a Google sheets template if you’d like to have a look, you have to give third party script permissions though.

2 Likes

Yes please David this would be a massive help!!!

If you could show me the script too that would also be handy

Here is a link to the Google sheets template. This is not my portfolio just an example.

If you go to the script editor in the spreadsheet you’ll see the code below. When you run it manually you’ll see it adds another row to the history tab (row number to use is on A1 in history tab if you need to reset it). After that you’ll need to set up triggers (button highlighted in picture below), time driven > day timer > 11 pm or something like this.

I’m on the Discord channel if you have any questions, just @DavidM me

2 Likes

Amazing…ill give it a go…added a trigger to it already, now I just I have to get it to work LOL…

FYI there are two DavidM’s on Discord

You can also create triggers programatically, looking at your code you would need to add something like:

function createTimeDrivenTriggers() {
    ScriptApp.newTrigger('portfoliovaluetracker')
        .timeBased()
        .everyDays(1)
        .atHour(23)
        .create();
}

Then Run this function. It’ll ask you for permission to modify your setup, and then it will take you through a oAuth process.

1 Like

Thanks for the help guys.

I have got this all working as intended. :smiley:

2 Likes