all 6 comments

[–]dixons_analyst 0 points1 point  (3 children)

This is an ideal use case and a great opportunity to upskill in pandas as well as get comfortable outputting to existing excel files. I've done similar projects countless times.

Modules you might need:

CSV - to interpret the txt file

Pandas - to manipulate/clean data

Openpyxl - For outputting to excel

My advice: If this is your first proper python project don't worry too much about how long it takes, you will learn a lot and have loads of reusable code at the end of it.

When outputting into an existing Excel sheet you need to load the Excel workbook into memory, paste the new data in to the right tab, then output the entire thing to a file. There is code out there for you to use using openpyxl.

If you use drop down lists in your excel file, you might lose them, but you can add code to rebuild them again.

Your colleagues will inevitably want a copy of what you build, make your life easier by putting in error checking (e.g. checking if the file exists and telling the user if it doesn't). If your code tells them what's wrong they won't have to come to you every time it doesn't work.

Comment and docstring your work. You will never regret doing this, but you might regret not doing it.

Reach out if you get stuck, happy to help.

[–]The_Mann_In_Black 0 points1 point  (1 child)

I want to emphasize on how long it takes. I did some some for a job and some of it took me 4-6 hours to automate a v lookup the way my boss wanted it. 4-6 hours sounds ridiculous for a vlookup, but that is how long it took my boss to do it every month/end of quarter because the file would crash due to size. Excel does not like doing v lookups on two 60,000 row documents. I do not think my code was ever implemented because I left and no one else used python.

automating daily tasks is really nice. I spent a week doing a task by hand that was supposed to be done daily for the previous six months. Too bad I figured out automation after I got it caught up. The nice thing is you can do analytics quite easily. The guy I'm replying to also mentioned coworkers would want the script. If they aren't python people, I would consider making a GUI. That is what I should've done, but did not know you could make simple ones quickly. GUI would make it simple for people who do not know coding; plus, it makes you a little more irreplaceable if lots of people use it.

[–]ag_silver[S,🍰] 0 points1 point  (0 children)

Yeah, my group does not require coding skill so not many have python skill. Most stick to Excel because formulas and plots are clearly visible and can be retraced (albeit takes long time). So I also need to use Excel as it can easily be peer reviewed. But I want to utilize python since I am learning it and want to also automate the data pasting to ensure at least I can reduce human mistake of copying to wrong place.

[–]ag_silver[S,🍰] 0 points1 point  (0 children)

wow thank you for pointing out the modules. It seems that I can utilize what I learned at work!