Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Feeding data from Sharesight into Google Sheets with the Sharesight API and OAuth 2.0

Sharesight is rather awesome. Long time fan.

Thought I would share this in case anyone ever tries to do something similar. It is Google Apps Script that can pull data from Sharesight into Google Sheets. I am no coder but it does the job.

https://www.callofthesky.com/import-data-from-sharesight-to-google-sheets/
2 people have
this question
+1
Reply
  • Hey Alex,

    I work as a developer here at Sharesight, primarily with Frontend and Javascript, so had a peek.

    Saw a few small issues, but all in all it worked quite well. Neat little usage of our API – you can get the same data by downloading an excel spreadsheet, but this is pretty automatic once you have it setup.

    1. This code only works for a Consolidated View, not just any Portfolio. This would return a 404 for a regular portfolio. It's a very easy to change by toggling between true and false in the ?consolidated=true.
    2. In trying it myself, it gave me some syntax errors around missing semicolons in your switch statements (eg. case 'quantity': for (...)), so I ran it through a beautifier and added the semicolons.

    I've fixed both those things in a quick little gist, should all work.
    https://gist.github.com/kylorhall/59139f99cb018bb1ee9ee44cbb7a6fd6

    ---

    The main thing to note about this, and perhaps tell your readers, is that this code should not be used just anywhere – your ClientSecret should be secret. In Google Sheets it's fairly safe, but I definitely wouldn't use code like this (the oAuth request mainly) on a website to display your portfolio value as anyone could then grab your credentials.

    You also may get a bit more out of our Performance Report, if you wanted it, though you probably know about it.

    - Kylor
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • Hi Kylor,

    Thanks for the constructive feedback and quick response.

    I have updated the code on my site and made a clear note that the ClientSecret (and therefore this code) should not be used in shared sheets. I noted your input of course.

    I did have a look at the performance report, it was more data than I needed for my purposes but if I ever need more I will utilise it.

    Keep up the good work.

    Cheers,
    Alex
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly