Sometimes a database is really not necessary. Why not try a simple excel sheet
Coded this in an hour; sips on coffee though 9:06:34 PM
I generated the excel workbook using a website called Mockaroo. Today’s task is to convert a basic excel sheet table into an HTML table. I broke the task into sub tasks which were then later translated into functions.
- Convert Excel Table into one dimensional List containing dictionaries
- Convert List into HTML document
- Save HTML string into a file with “.html” extension
The Excel Sheet looked like this:
The code generated an HTML table (using the style.css – see below) that looked like this:
This is the code
You could expand the code to make it more flexible like:
- Getting the HTML file name from the command line
- Create different tables based on different sheets in a workbook
- Create different HTML files based on different workbook (in a given directory)
- Convert HTML Table into Excel Sheet (well basically webscraping; using the python module: BeautifulSoup)
If you have any questions, write them in the comment section.
See you soon!