Tax Loss Harvest Alert with Google Finance

List your stocks and purchase prices in a Google Sheet, and this script will alert you if you can sell the stock for a "tax loss harvest."

Last updated: June, 2020

Contributed by Jeremy Glassenberg Site

When we purchase a stock and find the value dropped, there's an opportunity to sell that stock, purchase another, and claim a tax deduction. However, many brokerages don't let you know when you have that opportunity.

This script works with Google Sheets to alert you when stocks in your portfolio fall below purchase price. To use this script, enter your portfolio information into the Google Sheet, so the sheet knows what stocks you own and at what purchase prices. If anything falls below purchase price, you'll be notified via email of a tax loss harvest opportunity.

screenshot

Technology highlights

Try it

  1. Copy this sheet.
  2. In the calculations tab make sure your information in columns A through D are up to date.
  3. Open the script editor and run the checkLosses function to check for tax-loss harvesting opportunities.
  4. Set a trigger for the script to run hourly, or daily, or however frequently you want to check for opportunities on a continued basis.

Next steps

To get started with Google Apps Script, try out the codelab which guides you through the creation of your first script.

You can also view the full source code of this solution on GitHub to learn more about how it was built.

Feedback

Were you able to get the solution up and running?

If you have an idea for another solution you'd like to see featured in our gallery submit a request on the GitHub issue tracker.