This Python script parses a fixed-width eligibility or premium .txt file to extract structured transaction data. It identifies receipt numbers, policy details, transaction types (e.g., refunds, chargebacks), and saves the results in a clean Excel format.
- Parses raw carrier-generated
.txtfiles - Extracts:
- Policy number
- Data source
- Receipt reference number
- Gross and net premium amounts
- Refund/chargeback indicators
- Transaction type classification
- Outputs a structured Excel file with a timestamped filename
You receive an eligibility or premium file from a vendor/carrier. This script:
- Scans and extracts core fields
- Flags potential refunds and chargebacks
- Prepares a clean, exportable Excel file for auditing or reconciliation
- Python 3.7+
pandasopenpyxl
Install via pip:
pip install pandas openpyxl- Run the script in Google Colab or locally.
- Upload the
.txtfile when prompted. - The script will:
- Parse all lines
- Handle basic formatting issues
- Export results to:
Carrier Billing to Premium Recon (MMM.9.YYYY-MMM.8.YYYY).xlsx
A sample file is included:
sample_premium_input.txt
Use it to test and observe how the parser behaves.
- This version focuses on parsing logic only
- Does not yet integrate with billing or payables reconciliation (future scope)
Created by Tamarl Christie to automate and streamline premium file auditing as part of a larger billing reconciliation pipeline.