116|PYTHON – K-1 Creation

BYU Student Author: @TylerBooth
Reviewers: @Hyrum, @Erick_Sizilio
Estimated Time to Solve: 60 Minutes

We provide the solution to this challenge using:

  • Python

My solution utilizes the Pandas and PyPDF2 packages.

Need a program? Click here.

Last year, you graduated with your master’s degree in accounting. This year, you finished your CPA exams and finally became a licensed professional! After becoming an official CPA, you have decided to open your own accounting firm that specializes in partnership tax returns. The only problem is that you dread filling out repetitive IRS forms. You would like to spend less time doing manual data entry and more time advising your clients.

While you were in college, you took a class dedicated to learning Python. You know that a Python script could be a great solution to your data entry problem. However, you don’t remember learning how Python could interact with PDF files. Fortunately, a quick internet search suggested a Python package that may be just what you need! Here is the helpful webpage.

To access the PyPDF2 library, run this this line of code: pip install pypdf

Using the method suggested on the webpage, create a Python script that will do the following:

  1. Read the data from the .xlsx file
  2. Open a blank Schedule K-1
  3. Fill the Schedule K-1
  4. Save the Schedule K-1 as a new file
  5. Repeat the steps for every partner

Data Files

Note: The data file contains 14 columns. The first column “Key” contains values that correspond with the PDF fillable fields. The next 13 columns contain the data for each partner.

Suggestions and Hints

You can use pandas to easily read a .xlsx file and store it as a dataframe with this code:

Import pandas as pd 
Data = pd.read_excel(‘Insert .xlsx filepath here’) 


Solution Video: Challenge 116|PYTHON – K-1 Creation

Special thanks to @Hyrum for helping to create the solution file!