vividvilla / csvtotable Goto Github PK
View Code? Open in Web Editor NEWSimple command-line utility to convert CSV files to searchable and sortable HTML table.
License: MIT License
Simple command-line utility to convert CSV files to searchable and sortable HTML table.
License: MIT License
Is there a way to specify the tab character as the delimiter in the CLI?
If I run
$ csvtotable <tabseperatedcsv.csv> /tmp/out.html -d '\t'
the following error occurs:
Traceback (most recent call last):
File "/usr/bin/csvtotable", line 11, in <module>
load_entry_point('csvtotable==1.1.0', 'console_scripts', 'csvtotable')()
File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/csvtotable/cli.py", line 30, in cli
delimiter=delimiter, quotechar=quotechar)
File "/usr/lib/python2.7/site-packages/csvtotable/convert.py", line 49, in convert
delimiter=delimiter, quotechar=quotechar)
File "/usr/lib/python2.7/site-packages/unicodecsv/py2.py", line 110, in __init__
self.reader = csv.reader(f, dialect, **kwds)
TypeError: "delimiter" must be an 1-character string
This also happens with Python 3.6.1.
Hey
I am facing this issue while using the csvtotable tool.
File "/home/sahaji/.local/lib/python2.7/site-packages/unicodecsv/py2.py", line 117, in next
row = self.reader.next()
_csv.Error: field larger than field limit (131072)
Is there a way to increase the field limit? It would be easy to do if it was read from a config file.
Similarly, for a larger number of rows, I got a memory error. How to allocate more memory?
Should be possible to pass CSV/JSON data in STDIN or read from STDOUT of another command or from URL download. This helps in visualizing JSON or CSV responses
Am getting an "Aborted!" error message.
I saved the file as UTF-8 text, then converted it to CSV. The output from the process is shown below.
[root@server ~]# csvtotable t.csv t.html
Aborted!
[root@server ~]# more t.csv
ABC,12.34,T,1
ABC,12.31,F,2
ABC,12.40,T,3
ABC,12.32,T,4
BTW, I am running CentOS 7, with Python development kit, patched, and latest updates (via yum). There were no errors during the install.
Hi! This is really useful tool.
The change-log any kind will be very useful. To track what's going on and what a new release gives me.
Thanks
Hi!
Is it possible to align the columns with digits to right?
Thanks,
Sergiy
Why there are so many unresolved issues and unmerged PRs? If you can give me write access I can help you develop this repo.
For example,there is a csv file :
link,title,description,date
http://github.com/1,title1,1,20170815
http://github.com/2,title2,2,20170815
http://github.com/3,title3,3,20170815
http://github.com/4,title4,4,20170814
output should like this:
title | description | date |
---|---|---|
title1 | 1 | 20170815 |
title2 | 2 | 20170815 |
title3 | 3 | 20170815 |
title4 | 4 | 20170814 |
Successfully installed csvtotable using pip package, but still getting this error:
csvtotable not found.
Is it possible to update the AUR package?
https://aur.archlinux.org/packages/csvtotable/
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=csvtotable
OK, I was able to use the workaround, then also did the upgrade; in both circumstances, I was able to generate HTML. However...upon taking closer look at the actual output file, it looks like it uses "jQueryUI" and another JavaScript-embedded script. It should be actively displaying the information (sorting, searching, etc.)
I was unable to see this done. What am I doing wrong?
Hi! First, thanks for this project, it served my goal very well!
When using an UTF-16 file, it prints the error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
When converting the file to UTF-8 using iconv
it works fine.
It would be nice if this tool could be used without having to delete the HTML file afterwards (when you're done reviewing the CSV file).
For example, you'd run csvtotable my_file.csv --view
(or similar) and view the HTML page in your browser directly without writing it to a file (similar to how you can run a webserver by doing python -m http.server 8000
).
When I generate the HTML code, do I legally own the output?
Clicking on date column header does not make sorting correct.
Can I link javascript and css from html file like this:
<script src="jQuery.min.js"></script> <script src="dataTables.js"></script> <script src="scroller.js"></script> <script src="Buttons.js"></script> <script src="csv2table.js"></script>I have tried this. not working.
Thanks for csvtotable! It works great except for one (minor) issue. The rows of my input files are sorted in a specific order but csvtotable appears to automatically (re)sort the data on the first column when generating the html table. Not a huge deal, but it would be nice to have the option to preserve the row order of the input file. Again, thanks for csvtotable!
In getting started (README) it says csvtohtml
and I think you meant csvtotable
On a separate issue, first CSV I tried it on I get a char encoding issue. The CSV is not public so I can't attach it, but I'm sure you can find some that contain utf8 chars
Traceback (most recent call last):
File "/usr/local/bin/csvtotable", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/csvtotable/cli.py", line 30, in cli
delimiter=delimiter, quotechar=quotechar)
File "/usr/local/lib/python2.7/dist-packages/csvtotable/convert.py", line 48, in convert
for row in reader:
File "/usr/local/lib/python2.7/dist-packages/backports/csv.py", line 394, in __next__
lineobj = next(self.input_iter)
File "/usr/lib/python2.7/codecs.py", line 314, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf4 in position 818: invalid continuation byte
Really nice program. Is there a way to add names to the column 1 to column n to something else, please?
ideally i would like to have column 1 is name, column 2 is date, column n to be measurements x. Also, any way to add my own text at the top and at bottom of the page, please?
this soft is that mysql >>> html ,I get data from mysql
so can I delivered delivered my soft on githup?
Would it be possible for the next version to include in the final html a line
<!-- This file was made by csvtotable https://github.com/vividvilla/csvtotable -->
?
Knowlegeable visitors to my pages have been asking me how it was done ...
When the last row of a CSV has a trailing newline, i.e. an empty line at the end, then the HTML page displays an error popup upon load:
DataTables warning: table id=table - Requested unknown parameter '0' for row 11227, column 0. For more information about this error, please see http://datatables.net/tn/4
I have a table with over 50,000 rows, and growing... Having so much makes the page take an extreme amount of time to load... Is there any way of not showing the table until a search is made, sorta like google/youtube etc. ?
If I have a file called "t.csv", to create "t.html", and "t.csv" is approx 143 lines in length, and I want to paginate every 20 row, I am guessing that the syntax is as follows:
csvtotable ./t.csv ./t.html -p -o -vs 20
Somehow, it remains as infinite virtual scrolling, rather than limiting to 20 rows. Am I doing something wrong, or was this intented to always be infinite scrolling?
你好 我借鉴了您的代码 写了从mysql中读取数据生成html table,我可以发表出来 共享吗
if I want to insert image in each line.
so, what can i do.
I need to change template.html ?
thx.
Attached the CSV
data.zip
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.