This tool is designed to scrape credit card purchase data from a bank's website, categorize the purchases, and generate a financial summary in an Excel file. The summary can then be exported as a PDF and emailed to a specified recipient.
- Web Scraping: Collects credit card purchases for a given month from the bank's website using HTML parsing with Beautiful Soup.
- Categorization: Organizes purchases into predefined categories based on a customizable dictionary. Unrecognized purchases can be updated later.
- Excel Integration: Generates an Excel file that allows for manual adjustments and summary viewing of categorized purchases.
- VBA Automation: Includes VBA scripts to facilitate data management, PDF generation, and emailing functionality.
This app was created in Apple's Automator
- Captures the HTML content of the bank's page.
- Stores it as a text file in the project's directory.
- Launches the
html_script.pypython script to begin parsing the HTML. - Launches the excel file (
ExcelPasterApp.xlsm) to continue the process.
This Python script performs the following tasks:
- Reads HTML content from the file created by
Get My App.app. - Parses the content to extract purchase data.
- Categorizes each purchase based on predefined categories.
- Writes the organized data into an Excel file with specified formatting.
The Excel file contains several VBA scripts that automate tasks such as:
- Clearing previous data upon opening or closing the workbook.
- Copying data from one worksheet to another based on user input.
- Saving the summary as a PDF and emailing it using the
emailpdf.pyscript by way ofPythonCommand.scpt.
This AppleScript is used to execute the Python email script from within Excel:
Note: For this to work, you must copy the script file
PythonCommand.scptand paste it in the directory:/Users/<username>/Library/Application Scripts/com.microsoft.Excel/for the computer you wish to run this on.
This Python script handles the emailing of the generated PDF. It utilizes the SMTP protocol to send the PDF as an attachment to a specified email address. The script requires the email address and password to authenticate with the email server.
-
Ensure you have Python installed with the following packages:
pandasbeautifulsoup4openpyxl
-
Copy the
PythonCommand.scptfile into the appropriate directory. -
Customize the
chargesdictionary inhtml_script.pyto reflect your specific categorization needs.
Note: This tool is intended for use with one specific credit card company and its charges reflect the frequent charge of the user it was made for. A significant amount of customization to the python code and excel file will be required if you intend to implement this elsewhere.
- Run
Get My Data.app - When the
ExcelPasterApp.xlsmopens, navigate to the appropriate month. - Make small manual adjustments to the data as required.
For the most part, the data should already be organized but there may be a few unique purchases that are not recognized.
- Send this PDF to your email for your records by clicking the "Save Summary" button on the Excel sheet.
- Update the
sendervariable inemailpdf.pywith your email address. - In the Excel's VBA, replace the
;passwordin theAppleScriptTaskwith a semicolon and then your authenticated password. Eg.;Abc123 - Also in the same VBA, Update the
emailvariable to be the recipient's email.
- Ensure that your email provider allows SMTP access and that you have enabled any necessary settings (e.g., less secure app access).
- The script assumes that the structure of the HTML from the bank's website does not change. Any modifications to the HTML structure may require updates to the parsing logic in
html_script.py.
This project is licensed under the MIT License. See the LICENSE file for more details.
- This tool is intended for personal use and should not be used for commercial purposes without proper modifications and testing.