A simple Python script that reads data from an Excel file (.xlsx) and exports it as an HTML table.
- Read Excel files using pandas
- Convert data to a clean, formatted HTML table
- Save output as an HTML file (
ot.html)
Make sure you have Python and the following library installed:
pip install pandas openpyxl- Place your Excel file (for example,
OT.xlsx) in the same folder as the script. - Run the script:
python main.py- After execution, a file named
ot.htmlwill be created in the same directory.
# Import the required dependency
import pandas as pd
# Read Excel file
df = pd.read_excel("OT.xlsx")
# Export as HTML file
df.to_html("ot.html")- Input file:
OT.xlsx - Output file:
ot.html
- This script works best with tabular data (rows and columns).
- You can customize the output file name or HTML styling if needed.
Author: Md Shahriar Parvez License: MIT License