Git Product home page Git Product logo

csv-to-html-table's Introduction

CSV to HTML Table

Display any CSV file as a searchable, filterable, pretty HTML table. Done in 100% JavaScript.

Check out the working demo: http://derekeder.github.io/csv-to-html-table/

Usage

1. Clone this repository (in the command line)

git clone [email protected]:derekeder/csv-to-html-table.git
cd csv-to-html-table

2. Add your CSV file to the data/ folder

3. In index.html configure the init_table() function

<script>
  init_table({
    csv_path: 'data/Health Clinics in Chicago.csv', 
    element: 'table-container', 
    allow_download: true,
    csv_options: {separator: ',', delimiter: '"'},
    datatables_options: {"paging": false}
  });
</script>

Available options:

  • csv_path Path to your CSV file.
  • element The HTML element to render your table to. Defaults to table-container
  • allow_download if true, shows a link to download the CSV file. Defaults to false
  • csv_options jQuery CSV configuration. Use this if you want to use a custom delimiter or separator in your input file. See their documentation.
  • datatables_options DataTables configuration. See their documentation.

4. Run it

You can run this locally using this handy python command:

python -m SimpleHTTPServer

navigate to http://localhost:8000/

5. Deploy it

GitHub pages You can host your table on GitHub pages for free! Once you've made all your changes and committed them, push everything in the master branch to gh-pages which automatically enables GitHub pages.

git push origin master:gh-pages

Then navigate to http://your-github-username.github.io/csv-to-html-table/

Read more on working with GitHub pages projects.

Web server This project should work on any web server. Upload this entire project (including all the css, data, fonts and js folders) to a public folder on your server using FTP.

6. iframe it (optional)

Want to embed your nifty table on your website? You can use an iframe. Once you've deployed your table (above in step 5) you can link to it in an iframe right in your HTML.

<iframe style="border-style: none;" src="http://derekeder.github.io/csv-to-html-table/" height="950" width="600"></iframe>

Dependencies

  • Bootstrap - Responsive HTML, CSS and Javascript framework
  • jQuery - a fast, small, and feature-rich JavaScript library
  • jQuery CSV - Parse CSV (Comma Separated Values) to Javascript arrays or dictionaries.
  • DataTables - add advanced interaction controls to any HTML table.

Errors / Bugs

If something is not behaving intuitively, it is a bug, and should be reported. Report it here: https://github.com/derekeder/csv-to-html-table/issues

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Send a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2015 Derek Eder. Released under the MIT License.

csv-to-html-table's People

Contributors

derekeder avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.