why would an accountant bother to learn python?
If you are an accountant or you work with spreadsheets a lot, then you may understand more about programming than you think.
Seriously ...
Understanding spreadsheet concepts such as cells, ranges, functions, formulas, and even just the idea of wrangling data to get it into the format that you want, can make it easier for you to understand the basic concepts used in writing Python code.
You will still need time to master programming, and you will get frustrated as you work on projects, but learning the basics may be easier for you simply because of your experience with spreadsheets.
Now, you may be thinking, why even bother learn how to program? You may argue that:
- Spreadsheet programs such as Microsoft Excel are really simple to use.
- Exporting data from different software to a spreadsheet for further analysis is often an easy option.
- Spreadsheets are usually good enough for most accounting tasks, and perfect for those one-off analyses or small, quick calculations.
And, these are all great reasons to keep using spreadsheets. But let's face it, spreadsheets are NOT the BEST tool for EVERY job.
Please don't get me wrong on this. I’m not suggesting that accountants should replace Microsoft Excel, Google Sheets, or [insert your favorite spreadsheet software here], with Python.
Instead, I'm proposing that Python programming skills can be a useful addition to an accountant's toolkit, mainly for handling the more complex and repetitive tasks which tend to highlight what’s not so great about working with spreadsheets.
What do I mean?
1. Spreadsheets can get really messy, really fast ...
Just think about what happens as our tasks get more complex.
To start, consider what happens when working on analyses that involve merging data from multiple worksheets, or cross-referencing different workbooks to perform data lookups. It can become a challenge to manage links between different files, especially if any of the linked files happen to get changed or are moved to a different location.
By using Python, we can take advantage of free software libraries, such as Pandas, which make it a lot easier to work with multiple worksheets or workbooks, without needing to embed and manage links in the actual files.
Next, consider what happens when performing complex calculations that lead us to nest multiple functions in a single cell. The resulting long formulas can be difficult to review. This may cause us to miss errors that may have been easily identified if the layout of the formula was different.
Because of how code is usually formatted in Python, it can be easier to review the logic used to complete a task in Python, and thereby help us discover certain errors before they negatively impact decision-making.
2. Spreadsheet use tends to be labor-intensive and error-prone ...
Think about a recurring spreadsheet task that takes up a lot of your time and effort and is very easy to mess up.
Often in accounting, a lot of the same procedures are repeated on a daily, monthly, quarterly or annual basis to provide updated versions of the same basic spreadsheet reports. The preparation of some of these reports may involve tons of transformations to get the data into a format that we can work with, followed by multiple steps to then complete the actual task. On one hand, these tasks are tedious, and on the other hand, it’s really easy to skip a step or make mistakes, especially if the process is not clearly documented.
By using Python, all the steps completed in the process would be documented in the code and saved for future use, including all of the data transformations applied. We can also add comments to explain any steps or thought processes that may not be clear to someone else reviewing our work, or even to our future self two weeks later.
This would allow us to just re-run the program to generate the report in the future which effectively automates the process (or at least aspects of it), as opposed to us having to manually update the spreadsheet each time. Automation often reduces errors, assuming the program is thoroughly tested for accuracy. And, automation can also reduce the time and effort required to complete the same task in future weeks or months, after the program has been created.
3. There is only so much that we can do with spreadsheets ...
Python is a general purpose programming language, which means that it can be used almost anywhere, which means that we are not limited to just using it to help us be more efficient and accurate when working with spreadsheets. Python can be used to connect different systems to perform tasks with limited human intervention, which can be useful for automating any routine workflows.
Workflow automation is, at least in my opinion, the best reason to use Python, as an accountant. For example, Python can be used to write a program that pulls sales data from a database, generates a daily sales summary report and emails it to the sales manager each morning at 8:00 am. The program can even be scheduled to automatically run at a certain time and send the report without you needing to lift a finger.
TAKEAWAY
By having both spreadsheets and Python in our accounting toolkit, we can take advantage of both the simplicity of working with spreadsheets and the power of Python to make our work lives just a bit easier overall.