This Python script converts CSV files into interactive HTML reports, perfect for both technical and non-technical audiences. The generated report features:
- Clickable URLs for easy navigation.
- Row Deletion: Easily remove rows from the table in the browser.
- Dark Mode: Toggle between light and dark themes for optimal viewing.
- Sorting and Filtering: Built-in search and sort functionality using DataTables.js.
This tool is ideal for generating reports from CSV data, making them more readable and interactive. It’s especially useful when sharing data with teams, management, or anyone who needs quick access to information in a user-friendly format.
- Responsive Table: Automatically resizes and adjusts to different screen sizes.
- DataTables Integration: Provides built-in sorting, filtering, and pagination.
- Dark Mode Toggle: Easily switch between light and dark themes for a modern UI.
- Row Deletion: Allow users to delete rows directly from the table (client-side).
- Customizable: Modify and extend functionality to suit your needs.
- Python 3.x
- Pandas (for reading CSV files)
- An internet connection to fetch DataTables.js and CSS.
git clone https://github.com/gray-area/csv_to_html.git
cd csv-to-html-reportEnsure you have Python 3 installed, then install the necessary dependencies:
pip install pandasConvert a CSV file to an HTML report
python csv_to_html.py <input.csv> [output.html]-
<input.csv>: Path to your CSV file.
-
[output.html]: (Optional) The name of the output HTML file. Defaults to report.html.
Example:
python csv_to_html.py results.csv report.htmlThis will generate an HTML report from results.csv and save it as report.html.
Once the report is opened in a browser, you can toggle between Light Mode and Dark Mode using the "🌗 Toggle Dark Mode" button at the top.
Here's an example of what the generated report looks like:
coming soonFork the repository.
- Create a new branch (git checkout -b feature-name).
- Make your changes and commit them (git commit -am 'Add new feature').
- Push to your fork (git push origin feature-name).
- Create a new pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- DataTables for providing the awesome table functionality.
- Pandas for making data manipulation so easy.
You can further extend this script by:
- Modifying the HTML template to match your company's branding.
- Adding more interactivity (e.g., export options or advanced filters).
- Creating a backend server (Flask/Django) to make this tool accessible as a web app.