Hüseyin
Hüseyin

Reputation: 79

Convert multiple tables from a html file to Excel preserving the CSS styles

I have a html file and there are some tables, and I want to convert this html to Excel. Actually I can copy all page and paste it in Excel but I will have to repeat this process other html files. Can I use python for this process?

enter image description here

Upvotes: 0

Views: 1507

Answers (2)

Brad Martsberger
Brad Martsberger

Reputation: 1967

tablepyxl is supposed to do what you want.

Upvotes: 1

Irfanuddin
Irfanuddin

Reputation: 2605

You can use Pandas in Python.

import pandas as pd

df = pd.read_html(html_file)

writer = pd.ExcelWriter('pandas_simple.xlsx', engine='xlsxwriter')

df.to_excel(writer, sheet_name='Sheet1')

writer.save()

Upvotes: 0

Related Questions