ARTICLE PREVIEW
Create a Python App Using AI (and automate your finance processes)
Author: Adam Shilton, March 2024
Intro
For years, I resisted learning how to code (I wish I hadn’t).
I’d done a bit of web design, i.e copying and pasting HTML from others, but that was it.
Then I got thrown in the deep end working with Microsoft Dynamics. An auto-update broke my customers’ systems.
I spent 48 hours (with no sleep) learning Microsoft’s AL language to provide VERY basic patches.
I then forgot about coding…
Since then, ChatGPT became a thing, and I’ve used Python for all sorts of stuff like writing apps to re-format Excel data and creating forecasts.
If only I’d had ChatGPT back in my Dynamics days
With that in mind, let's look at how we can build Python apps to help with the work we’re doing in spreadsheets.
Use Case
In this scenario, we’ll imagine that we are working for the Group Finance Team working in the headquarter.
Our task is to consolidate the headcount reports from all countries in order to have a report on which we can run analysis. We have to do this every month and usually takes a few hours to come up with a clean file.
This headcount report by country shows information like, country, department, job title, salary and FTE.
Problem: every country reported a report with a different format and some errors you need to clean.
One of the solution would be to implement a consolidation tool, an harmonized template or a sharepoint tool, but as we know, there are a lot of situations where you can not influence the format of the data you received and you have to do the harmonization and cleaning work.
This is the goal of this guide.
How are we going to automate this task to simplify using AI?
We’ll create the Python code to tidy up and format the data before merging them all together into one spreadsheet.
We’ll also be creating an app that could be used by another team member to run the code, even if they don’t have Python installed.
Cool eh!?
So let’s have a look at what we’ll need.
Tools you will need
1. A Large Language Model that is good with coding
Most language models do are OK at coding, but some of them don’t have up to date lists of libraries, and require more troubleshooting.
Reminder: we did a deep dive on the best LLMs tools here.
The 3 best options for coding are:
You can use others, you just might find you get more errors when you run the code so you might have to use more ‘That didn’t work, here’s the error’ type prompts to update the code until you get it right.
2. Python installed on your computer
The whole data cleaning part that we will show you below is something you could do in a browser environment like Google Colab. And if you don’t want to make an app but just automate the data cleaning for yourself, this is sufficient for you.
But in order to create a Python app, your computer has to have the language installed.
If you don’t know how to install Python, I made a video in the next session below in the step by step section.
And if you don’t know whether you have Python or not, check the
mini 2-min tutorial here.
3. Microsoft Visual Studio Code
This is the application that we’ll be using to run the code on our computers. It can be used to run different coding languages (Python, C#, JavaScript etc).
That’s why I’d suggest downloading Python via this application as it’s super easy to download and link up.
We’ll walk through the steps of downloading Visual Studio Code & Python below
Setup steps to install Python & Visual Studio Code
- Download the latest version of Python here.
- Install, ensuring you check the option for _PATH
- Test python is installed by opening your command prompt and typing ‘Python —Version’
- Go to this link: https://code.visualstudio.com/download
- Install, again giving access to the _PATH
- Click the ‘Extensions’ icon on the left sidebar that displays when you open Visual Studio Code, and search for Python.
- Install
- Check Path & System Variables – If these aren’t setup correctly, you might have trouble running your Python script. Here’s a link to how to check your Path & System variables, plus an explanation of why this is important.
You can see me performing this in the below video:
This is a protected part of the content.
Please login below or purchase a membership
here to view the entire article.