/fixie

extract data from 1099 forms and parse it to .csv

Primary LanguagePythonMIT LicenseMIT

FIXIE - 1099 Data Extraction

This script processes a 1099 form in .pdf format, extracting data from the 1099-DIV and 1099-B sections on the Summary Information page. It also extracts data from the Detail for Dividends and Distributions pages, grouping and summing by ticker symbol. The output is a set of .csv files:

  • summary.csv. Extracts the 1099-DIV section from Summary Information page.
  • income.csv. Displays data from the Detail for Dividends and Distributions pages. Groups and sums rows by ticker symbol, with these columns:
    • Nonqualified dividends
    • Qualified dividends
    • Short term capital gains
    • Long term capital gains
    • Section 199A dividends
    • Foreign taxes paid
    • Tax exempt income
  • broker_transactions.csv. Extracts data from the 1099-B section of the Summary Information page ("Summary of Proceeds, Gains & Losses"), parsed into these columns:
    • Short term gain/loss
    • Long term gain/loss
    • Undetermined total
    • Grand total
  • result.xmls is a single file combining the data described above into three worksheets.

Processes

The script takes a PDF file, extracts specific sections into ./input, then processes the data using PyPDF2 and tabula-py. After processing, it deletes the copies in ./input, leaving the original file untouched, and stores output files into ./output. This tool is a complement to a tax calculator spreadsheet.

Usage

  1. Python and Java are required dependencies for this program.
  2. Activate the virtual environment: source venv/bin/activate.
  3. Install dependencies: pip3 install -r requirements.txt.
  4. Create two empty folders in the main directory: ./input and ./output.
  5. Place a 1099 file (in .pdf format) into the ./input folder.
  6. Run the program: python3 local.py.
  7. Find the result files in the ./output folder.

Use as a Quick Action for Mac

To use this program as a Quick Action on a Mac:

  • Create an Automator Quick Action that points to ./driver.sh (an example script and guide is provided in ./automator.sh).
  • Add your Quick Action to Finder on your Mac.
  • Right-click any file in Finder; the Quick Action you created should be displayed under 'Quick Actions' (tested on Mac OS X Sonoma 14.1.1).

Contribute

Please feel free to clone, fork, or contribute in any way you find interesting.