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:
https://www.lynnamacher.com/gui-python-calculator-stand-alone-app-with-pyinstaller/
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:
https://github.com/amacher/excelPullLastNameStandAlone/blob/main/PullLastName_allDir.py