Skip to content
Advertisement

How can I webscrape information in the html element and save it to an Excel row using Beautifulsoup and any excel writer(Pandas)? [closed]

I’m new to python and I’m doing it for my project. Can someone help me save it to an excel file?.

This is needed for multiple site URLs so need to add each information into new rows in excel. Sample HTML code is attached below. Please help me on saving it to excel rows and columns and how to iterate it using for loop.

Advertisement

Answer

I would suggest you just use openpyxl directly rather than via Pandas, this would give you much greater control over how your Excel file would be formatted.

Here is how you could build up multiple row in an Excel file:

JavaScript

This would give you an Excel sheet looking like:

Excel screenshot

With extra work you can apply any styling you prefer.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement