Skip to content

Use Jinja2 templates to format data from CSV files.

License

Notifications You must be signed in to change notification settings

chrispatin/jinja-csv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jinja-csv

Use Jinja2 templates to format data from CSV files.

Installation

Works on Python 3.4+.

pip3 install https://github.com/gabihodoroaga/jinja-csv/releases/download/v0.2/jinja_csv-0.2-py3-none-any.whl

or

git clone https://github.com/gabihodoroaga/jinja-csv.git

cd jinja-csv

python3 setup.py install

Example usage

Simple usage with output

jinja-csv -i example/users.csv -t example/users.j2 -o example/users.sql

If you don't specify the output argument then you can pipe the result to another command.

jinja-csv -i example/users.csv -t example/users.j2 | mysql -u root -p testdb

Arguments

-i, --inputfile     The input csv file.
-t, --template      The Jinja template file
-o, --output        The output file, or the output folder when --file argument is present
-f, --files         Generate one file per row
-r, --row           Index of the row to be used for the name of the file
-e, --ext           The file extension to be used

Build

python3 setup.py build
python3 setup.py sdist

Authors

  • Raymond Chee (original author)
  • Gabriel Hodoroaga

Acknowledgments

Forked from github.com/rjchee/jinja-csv, fixed some issues and created the setup.

About

Use Jinja2 templates to format data from CSV files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.3%
  • Jinja 3.3%
  • Shell 0.4%