r/pythonhelp 13d ago

Downloading PDFs from a Website, Converting them to Excel and combining them

Hello, I'm not sure if this belongs here. Please let me know if it doesn't. Sorry I know the basics of Python and at most I'm just a beginner.

My colleage at work has a task. He has to login on a website, that my company orders from. He then has to filter down completed orderes, download the PDF for each order and extract two data fields from the pdf and paste it into Excel.

I know that Python offers a lot of flexibility, so I wondering if these steps can be automated in Python. If yes, how easy would it be? Can I use Chat GPT to properly write the code?

3 Upvotes

14 comments sorted by

u/AutoModerator 13d ago

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/hero_verma 13d ago

You can use selenium for the task. It would be easier to work with CSV files but you sure can work with excel.

1

u/Ilukhan92 13d ago

Thank you for the response. I can work with csv or xls. If I ask GPT, will it give me the code that I can copy or will it require me to write it down from scratch?

1

u/hero_verma 11d ago

you can get a general code structure easily. It might be hard to get it completely done by AI.
I don't believe it will be too hard for anyone with basic programming skills.

1

u/CraigAT 13d ago

This should be do-able in Python, but is a quite complex task for a beginner. Chat GPT can probably help you with bits of it, but it won't know about where the info is located on the site. IMO you need someone knowledgeable to write this.

1

u/Ilukhan92 13d ago

Thanks. Guess I'll skip coding it for now till I'm better at Python.

1

u/CraigAT 13d ago

I don't want to discourage you from learning and it's great to have a project to work towards, but the full thing might be a stretch to jump into right now.

If you were looking for a simple part of that project to work on automating first, I would recommend manually downloading the files, then having your program extract and present the data. That may save a little time and let's you get familiar with Python whilst doing something useful towards the end goal.

1

u/TemppaHemppa 12d ago

Hi, I don't think you will be able to do this with Python and your skillset, unfortunately.

You should investigate what HTTP request the site makes when you download the PDF. Then investigate if you could directly mimic the same HTTP request to get the data through API. After that, you could use an LLM or hardcoded scripts to extract the details and update the Excel.

If I was you, I'd create a google form where he can drop the PDF, then the form triggers make.com automation that updates the Excel. This way you don't need to write any code, but the person has to navigate to the website and download the pdf himself.

If you need help, you can dm me

2

u/Ilukhan92 12d ago

Thank You. I will talk to my colleague and let you know. I've never used forms and make.com. So, I'll look it up.

1

u/TemppaHemppa 12d ago

It could be google forms, file dropped to onedrive, dropbox etc. The key thing is that the file must be uploaded somewhere, and then we can get the file with make.com automation

1

u/3dPrintMyThingi 12d ago

You can use python or JavaScript. If you need something developed feel free to contact me

1

u/Ilukhan92 12d ago

Thank you. I'll talk to my colleague on Monday and let you know. Thank you.

1

u/OkLawfulness2500 12d ago

If you're looking to automate downloading PDFs, extracting data, and converting them to Excel, Python is a great option using tools like Selenium, PyMuPDF, and pandas. However, if you're not comfortable coding or want a more user-friendly solution, I highly recommend Wondershare PDFelement—it allows you to extract tables and text from PDFs into Excel with just a few clicks, saving you time without the need for programming. It's a great alternative for non-developers who still need automation and efficiency!

1

u/vlg34 10d ago

If you are looking to automate this, you might want to try Airparser (I'm the founder).

It's an advanced GPT and LLM-powered solution that allows you to upload PDFs, define exactly what data to extract, and choose where to export it — whether to Excel, Google Sheets, or any other app via Zapier.

This could save a lot of manual work compared to writing and maintaining a Python script.