Skip to content

Gettysburg-College/csv_xlsx_to_html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transcription: CSV/XLSX to HTML Format

About CSV/XLSX to HTML project

Get student information (rows) from files and convert into html. The program will generate a html file. For staffs at Gettysburg College who work with dotCMS system, we can copy source code from that file and paste it into the dotCMS editing page, especially for editing Dean's Honor List and Dean's Commendation List.


Table of content

  1. Model
  2. Codebase
  3. Files format
  4. How to run the package

Model:


Codebase:

  • Data folder:
    • file_name.csv or file_name.xlsx: the files that need to be convert into html. Data is stored as a table following our format.
  • Doc folder:
    • model.jpg: the structure of this program as a UML graph.
  • Output folder:
    • output_file.html: the output file of this program.
  • Tool folder:
    • table.py:contains object-oriented class Table. Each Table object is a class year cohort including:
      • table_id: each table will have only one unique id
      • table_name: name of table
      • rows: each row is a student with information stored as Dictionary
    • reader.py: contains object-oriented class Reader needed to pass parameter: data file path as str. This class reads data from .csv or .xlsx file and store data in each class each as rows in Table object.
    • page.py: contains object-oriented class Page needed to pass parameter: a Reader object. This class contains skeleton structure for HTML file.
  • main.py: the main file to run this program.
  • requirements.txt: contains required libraries and their version. Follow How to run the package section to know how to use this file.

Files format

File location:

  • All files must be put in data folder.

File format:

  • Column name (1st row): Last-Name, First-Name, Middle-Name, Exp-Grad.
  • Students are listed in order from Seniors, Juniors, Sophomores, and First Years.
  • Note: check files Deans Commendation List.csv or Deans Commendation List.xlsx in folder data for examples.
Last-Name First-Name Middle-Name Exp-Grad
Seniors
stud's last stud's first stud's middle Exp Grad yr
... ... ... ...
Juniors
stud's last stud's first stud's middle Exp Grad yr
... ... ... ...
Sophomores
stud's last stud's first stud's middle Exp Grad yr
... ... ... ...
First Years
stud's last stud's first stud's middle Exp Grad yr
... ... ... ...

How to run the package

  1. Requirements:
  • Python 3
  1. Run this in bash:
  • Install related python library:
pip3 install -r ./requirements.txt
  • Run the main file from the package:
    • To get html of Commendation List:
    # python3 main.py <data_file> <output_file>
    
    # For example:
    
    python3 main.py "Deans Commendation List.csv" "commendation.html"
    
    The html file can be found in output folder.
  • Note: You can change pip3 to pip and python3 to python if possible.
  • Note: command Deans Commendation List.csv can be changed based on your file name.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published