Skip to main content

Create personal stock portfolio tracker with Google Sheets and Google Data Studio

I have been investing in the stock market for a while. I was looking for a software tool that could help me better manage my portfolio, but, could not find one that satisfied my needs.

One day, I discovered that the Google Sheets application has a built-in function called GOOGLEFINANCE which fetches current or historical prices of stocks into spreadsheets. So I thought it is totally possible to build my own personal portfolio tracker with Google Sheets. I can register my transactions in a sheet and use the pivot table, built-in functions such as GOOGLEFINANCE, and Apps Script to automate the computation for daily evolutions of my portfolio as well as the current position for each stock in my portfolio.

I then drew some sort of charts within the spreadsheet to have some visual ideas of my portfolio. However, I quickly found it inconvenient to have the charts overlapped the table and to switch back and forth among sheets in the spreadsheet. That's when I came to know the existence of another Google product named Google Data Studio which I believed was the solution to my problem. Google Data Studio provides a built-in connector to Google Sheets to fetch data stored in spreadsheets and a powerful reporting tool to visualize those data into an interactive and beautiful dashboard.

So by combining Google Sheets and Google Data Studio, I can build a free, easy, interactive, beautiful, real-time, no-installation-needed, and personal stock portfolio tracker!

Free, easy, interactive, beautiful, real-time, no-installation-needed, and personal stock investment portfolio tracker with Google Sheets and Google Data Studio

Table of Contents

Concept

The idea is to take advantage of what is offered for free by Google Sheets, Google Apps Script, and Google Data Studio and pull them together to build a personal but powerful stock portfolio tracker. We can think of a spreadsheet as a database to keep track of transactions made within a stock portfolio. To track the portfolio's evolution, we need to know the daily prices of holding stocks and that is exactly what is offered by the GOOGLEFINANCE function. We can then use Google Data Studio to build a beautiful and interactive dashboard based on data from the spreadsheet. To save our time, we can go on to write a small script in Google Apps Script to automate some repeated tasks such as computing daily changes of the portfolio.

Relationship of elements in the stock investment portfolio tracker in Google Sheets and Google Data Studio

The picture above gives an overview about the relationship among building elements of the personal stock portfolio tracker:

  • The Transactions sheet is the input.
  • The Positions and Evolutions sheets are computed with data from Transactions sheet and GOOGLEFINANCE built-in function. The computation can be as simple as applying some pivot tables or built-in functions of Google Sheet. It can also be more complicated but more powerful and automated by writing a little script with Google Apps Script.
  • The Positions and Evolutions sheets are also refresh based on results returned from GOOGLEFINANCE, generally 20 minutes delay.
  • The 3 sheets are connected as data sources to the dashboard in Google Data Studio
  • The dashboard is refreshed regularly or manually by clicking on the refresh button to fetch new data from the spreadsheet

Demo

You can take a look at the sample spreadsheet below to have an idea of how the data is organized and related. It is possible to make a copy of the spreadsheet to study it thoroughly.

The dashboard in Google Data Studio visualizes data stored in the spreadsheet. It is interactive which means you can change some filters to see data from a different perspective. For instance, you can change the date range or select a particular stock.

Guides

In the series of posts, I share with you step-by-step how to make your personal stock portfolio tracker with Google Sheets and Google Data Studio. Please read the posts below:

  1. Manage Transactions with Google Sheets
  2. Monitor stock portfolio with Google Sheets (Pivot table and GOOGLEFINANCE function)
  3. Compute daily evolutions of a stock portfolio with Google Sheets and Apps Script
  4. Create stock portfolio tracker dashboard with Google Data Studio
  5. Compare stock portfolio to market indexes

TLDR

UPDATE: You can skip this tutorial and go directly to LION stock portfolio tracker, which is an enhanced version.

Follow the steps below to quickly make your copy version of the spreadsheet and the dashboard:

  1. Sign in to your Google account in your browser
  2. Make a copy of this Google spreadsheet: Sample Portfolio spreadsheet
  3. Go to the tab Data sources on your Google Data Studio home page
    • Create the data sources Transactions, Positions, Evolutions, Overview corresponding to the sheets of the same name on the copied Sample Portfolio spreadsheet.
  4. Go to this Sample Portfolio report and make a copy of the report.
    • In the data sources configuration dialog, select the new data source corresponding to the original data source by matching their names.
  5. DONE! Add your own transactions and refresh the dashboard

Configure data sources for the stock investment portfolio dashboard in Goolge Data Studio

Note

Some assumptions, definitions, or indicators made through this example are from my own experiences so I can totally understand if you might not agree with all of them. The purpose of this series is to introduce you to the possibility of building a personal stock portfolio tracker with Google Sheets and Google Data Studio. Once you get familiar with these applications, you can effectively define your own assumptions, definitions, or indicators that suit well your investment strategy.

References

Disclaimer

The post is only for informational purposes and not for trading purposes or financial advice.

Feedback

If you have any feedback, question, or request please:

Support this blog

If you value my work, please support me with as little as a cup of coffee! I appreciate it. Thank you!

Share with your friends

If you read it this far, I hope you have enjoyed the content of this post. If you like it, share it with your friends!

Comments

  1. Hello,
    I love your sheet and data concept and try to use your way managed my portfolio
    But I have a problem, how Can I make "evolution sheet" ? I can't figure out how it work.

    ReplyDelete
    Replies
    1. Hi,

      Same here, I also do not understand how to make Evolution Sheet. If it's manual work then it's very hard to update on timely wise.

      Do you get any solution? Please update if you find any solution for Evolution Sheet.



      Thanks.

      Delete
    2. Hi,

      I write a small google app script to generate the evolution of portfolio every day automatically after the market closes.

      I had plan to write another post to show how it is done but had not yet published it.

      Delete
    3. Hi ,

      Waiting for Evolution sheet Solution as said in Above comments , Really good work you have done in this I liked it , hope you will do more like this for Ulip plans Funds also if possible , Good work Keep it up

      Delete
    4. I have published LION stock portfolio tracker. Don't forget to check it out here https://www.allstacksdeveloper.com/p/lion-stock-portfolio-tracker.html

      Delete

Post a Comment

Popular posts

How to convert column index into letters with Google Sheets

How to convert column index into letters with Google Sheets

In Google Sheets, rows are indexed numerically, starting from 1, but columns are indexed alphabetically, starting from A. Hence, it is pretty straightforward to work with rows and trickier to work with columns as we need to convert between column index and corresponding letters. For example, what are the letters of column 999th in Google Sheets? In this post, we will look at how to convert a column index into its corresponding letters by using the built-in functions of Google Sheets. What are letters of the column 999th in a spreadsheet? Unfortunately, Google Sheets does not provide a ready-to-use function that takes a column index as an input and returns corresponding letters as output. However, there is a little trick of combining other available built-in functions to do the task. In Google Sheets, there is the ADDRESS function that returns the cell reference, according to the specified row index (first parameter) and column index (second parameter) in the input. For example,
Create a dividend income tracker with Google Sheets by simply using pivot tables

Create a dividend income tracker with Google Sheets by simply using pivot tables

As my investment strategy is to buy stocks that pay regular and stable dividends during a long-term period, I need to monitor my dividends income by stocks, by months, and by years, so that I can answer quickly and exactly the following questions: How much dividend did I receive on a given month and a given year? How much dividend did I receive for a given stock in a given year? Have a given stock's annual dividend per share kept increasing gradually over years? Have a given stock's annual dividend yield been stable over years? In this post, I explain how to create a dividend tracker for a stock investment portfolio with Google Sheets by simply using pivot tables.
Use SPARKLINE to create 52-week range price indicator chart for stocks in Google Sheets

Use SPARKLINE to create 52-week range price indicator chart for stocks in Google Sheets

The 52-week range price indicator chart shows the relative position of the current price compared to the 52-week low and the 52-week high price. It visualizes whether the current price is closer to the 52-week low or the 52-week high price. In this post, I explain how to create a 52-week range price indicator chart for stocks by using the SPARKLINE function and the GOOGLEFINANCE function in Google Sheets.
How to convert column index into letters with Google Apps Script

How to convert column index into letters with Google Apps Script

Although Google Sheets does not provide a ready-to-use function that takes a column index as an input and returns corresponding letters as output, we can still do the task by leveraging other built-in functions ADDRESS , REGEXEXTRACT , INDEX , SPLIT as shown in the post . However, in form of a formula, that solution is not applicable for scripting with Google Apps Script. In this post, we look at how to write a utility function with Google Apps Script that converts column index into corresponding letters.
Compute daily evolution of a stock investment portfolio by using only built-in functions of Google Sheets

Compute daily evolution of a stock investment portfolio by using only built-in functions of Google Sheets

To effectively track a stock investment portfolio, it is necessary to know its evolution in the past. As I use Google Sheets to track my stock investment portfolio, I have researched and successfully implemented several solutions. In this post, I am happy to share in detail how to compute the daily evolution of a stock investment portfolio by simply using only the available built-in functions in Google Sheets.
Slice array in Google Sheets

Slice array in Google Sheets

Many functions in Google Sheets return an array as the result. However, I find that there is a lack of built-in support functions in Google Sheets when working with an array. For example, the GOOGLEFINANCE function can return the historical prices of a stock as a table of two columns and the first-row being headers Date and Close. How can I ignore the headers or remove the headers from the results?
Create dividend income tracker with Google Data Studio

Create dividend income tracker with Google Data Studio

With transactions registered, it is easy to create a dividend income tracker with Google Sheets. However, a dividend income tracker in Google Sheets is not interactive. Instead of having different pivot tables and switching forth and back among them, I can create an interactive dividend income tracker with a single-page report on Google Data Studio. In this post, I explain how to create a dividend income tracker with Google Data Studio.
Compute cost basis of stocks with FIFO method in Google Sheets

Compute cost basis of stocks with FIFO method in Google Sheets

After selling a portion of my holdings in a stock, the cost basis for the remain shares of that stock in my portfolio is not simply the sum of all transactions. When selling, I need to decide which shares I want to sell. One of the most common accounting methods is FIFO (first in, first out), meaning that the shares I bought earliest will be the shares I sell first. As you might already know, I use Google Sheets extensively to manage my stock portfolio investment, but, at the moment of writing this post, I find that Google Sheets does not provide a built-in formula for FIFO. Luckily, with lots of effort, I succeeded in building my own FIFO solution in Google Sheets, and I want to share it on this blog. In this post, I explain how to implement FIFO method in Google Sheets to compute cost basis in stocks investing.
How to copy data in Google Sheets as HTML table

How to copy data in Google Sheets as HTML table

I often need to extract some sample data in Google Sheets and present it in my blog as an HTML table. However, when copying a selected range in Google Sheets and paste it outside the Google Sheets, I only get plain text. In this post, I explain how to copy data in Google Sheets as an HTML table by writing a small Apps Script program.