# CSVtoTable

Simple command-line utility to convert CSV files to searchable and
sortable HTML table. Supports large datasets and horizontal scrolling
for large number of columns.

DISCLAIMER: This is NOT an official version, nor am I affiliated
with the original creator Vivek R \@vividvilla
<https://github.com/vividvilla> (Upstream Author) This version is mostly
for me, if you wanna use it too go ahead but I give no promises of
function. If you notice any errors or issues please tell me!

## Demo

[Here is a demo](<https://NanashiTheNameless.github.io/csvtotable/sample/goog.html>)
of [sample csv](<https://github.com/NanashiTheNameless/csvtotable/blob/master/sample/goog.csv>)
file converted to HTML table.

###### (You can use [https://NanashiTheNameless.github.io/csvtotable/sample/index.html](<https://NanashiTheNameless.github.io/csvtotable/sample/index.html>) to see all the example HTML pages.)

## Installation

Get the Latest

```sh
python -m pip install --upgrade 'CSVtoTableNameless @ git+https://github.com/NanashiTheNameless/csvtotable@master'
```

Or get from PyPi (not reccomended, may be out of date)

```sh
pip install --upgrade CSVtoTableNameless
```

## Get started

```sh
csvtotable --help
```

Convert `data.csv` file to `data.html` file

```sh
csvtotable data.csv data.html
```

Open output file in a web browser instead of writing to a file

```sh
csvtotable data.csv --serve
```

## Options

```text
    Usage: csvtotable [OPTIONS] INPUT_FILE [OUTPUT_FILE]

      -c, -t, --caption, --title TEXT
                                      Table caption and HTML title
      -d, --delimiter TEXT            CSV delimiter
      -q, --quotechar TEXT            String used to quote fields containing
                                      special characters
      -dl, --display-length INTEGER   Number of rows to show by default. Defaults
                                      to -1 (show all rows)
      -o, --overwrite                 Overwrite the output file if exisits.
      -s, --serve                     Open output html in browser instead of
                                      writing to file.
      -h, --height TEXT               Table height in px or in %.
      -p, --pagination                Enable/disable table pagination.
      -vs, --virtual-scroll INTEGER   Number of rows after which virtual scroll is
                                      enabled.Set it to -1 to disable and 0 to
                                      always enable.
      -nh, --no-header                Disable displaying first row as headers.
      -e, --export                    Enable filtered rows export options.
      -eo, --export-options [copy|csv|json|print]
                                      Enable specific export options. By default
                                      shows all. For multiple options use -eo flag
                                      multiple times. For ex. -eo json -eo csv
      -ps, --preserve-sort            Preserve the default sorting order (not
                                      using this flag will cause table to be
                                      sorted by first column).
      --help                          Show this message and exit.
```

## Credits

[All Major Contributors](https://github.com/NanashiTheNameless/csvtotable/blob/master/CONTRIBUTORS.md)

[All Other Contributors](https://github.com/NanashiTheNameless/csvtotable/graphs/contributors)

[Datatables](https://datatables.net)
