Update to Excel file in Python

December 30, 2021

I went back to create a way to make the script into a stand-alone app that the client can use on their own using PyInstaller. I’ve used PyInstaller before for the calculator program:


To make this more usable for the client I used Tkinter. When the app opens it will ask for the file to process, I went a little further with this of select the file in a folder. When it gets the file, it also gets the path to that folder. This was done by separating out the path from the file path. From there it would go into a for loop it processes all the .xslx (Excel) files in that folder. Other file extensions can be added to the ‘ext’ variable. In the loop the file name coming in is updated with a ‘_update’ before the extension when it saves a copy, example:

Before: subscriberList-Chicago.xslx
After: subscriberList-Chicago_update.xslx

This way they would have the original, if they needed to look back at it and also have the updated one marked and can better manage their files.

With the Tkinker part of the stand-alone app there’s a window that displays when the file loads and while the application that is open that says:

“Select file in folder…
This window will close when done.”

The program will self-close after the last file is processed:

By not including the ‘root.mainloop()’ element, this is used to keep Tkinker file open till it’s closed out by quitting the app, it will close itself when the last process has finished.

When creating the stand-alone app with PyInstaller I was receiving several errors with:

“<frozen importlib._bootstrap_external>”

A quick update of PyInstaller and creating a basic ‘__init__.py’ file in that folder fixed that problem. The next issue is the final app came out to be over 300MB in size. Thinking this is due to how many libraries that were needed to run this app. I did try again by just importing certain elements and the size stayed the same. Maybe PyInstaller installs the full library or some of these are so huge that even calling out a sub-directory just didn’t save enough to alter the size.

The updated file is in Github:


Related Articles

Creating our own Basic Local Chatbot

Creating our own Basic Local Chatbot

This is a current work in progress there is still some issues with the program. It will at times have its own conversation and sometimes add empty assistant tags to the replies. This is all from the first 2 links in the code. After receiving my Azura AI-900...

read more
Python – Birthday List

Python – Birthday List

Birthday List Python Program Worked on a project for a publication to pull the birthdays of their members quickly. To help demonstrate what they were working with; they had two Word files containing tables of birthday months, the dates for the month were not in order...

read more

Pin It on Pinterest

Share This