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.
SpreadsheetAppservice is used to provide stored information to the Apps Script.
- Google Finance formula in Google Sheets are used to check stock prices in real-time and alert the script of changes.
- Copy this sheet.
- In the calculations tab make sure your information in columns A through D are up to date.
- Open the script editor and run the
checkLossesfunction to check for tax-loss harvesting opportunities.
- Set a trigger for the script to run hourly, or daily, or however frequently you want to check for opportunities on a continued basis.
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.
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.