csv-to-datatable
v1.0.6
Published
Transform CSV files into beautiful, interactive HTML tables with 5 stunning themes, advanced search, sorting, pagination, and export options (Excel, PDF, CSV)
Maintainers
Readme
📊 CSV to DataTable Generator
Transform your CSV files into beautiful, interactive HTML tables with advanced features and stunning themes.
✨ Features
- 🎨 5 Beautiful Themes - Dark, Light, Neon, Purple, and Ocean
- 🔍 Advanced Search - Real-time filtering across all columns
- 📑 Smart Pagination - Customizable page sizes
- ↕️ Column Sorting - Click any header to sort
- 📤 Export Options - Copy, CSV, Excel, PDF, and Print
- 📱 Responsive Design - Works on all screen sizes
- 🔒 Fixed First Column - Always visible while scrolling
- 💾 Persistent State - Remembers your settings
- ⚡ Lightning Fast - Handles large datasets efficiently
- 🎯 Zero Configuration - Works out of the box
Screenshot

📦 Installation
Global Installation (Recommended)
npm install -g csv-to-datatable🚀 Quick Start
Basic Usage
csv-datatable data.csvThis generates table.html with default dark theme and opens it in your browser.
With Options
csv-datatable sales.csv -t "Sales Report 2024" -T light -p 50 -s "25,50,100,200"📖 Command-Line Options
Positional Argument
| Argument | Description | Required |
|----------|-------------|----------|
| [file] | Input CSV file path | Yes (or use -f) |
Options
| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| -f, --file <path> | | Input CSV file (alternative to positional arg) | - |
| -t, --title <title> | | Title for the table | "Data Table" |
| -T, --theme <theme> | | Theme: dark, light, neon, purple, ocean | dark |
| -o, --output <path> | | Output HTML file path | table.html |
| -p, --page-length <number> | | Default page length | 25 |
| -s, --page-sizes <sizes> | | Available page sizes (comma-separated) | 10,25,50,100 |
| --enable-search | | Enable global search | true |
| --enable-sort | | Enable column sorting | true |
| --responsive | | Enable responsive design | true |
🎨 Available Themes
Dark Theme (Default)
csv-datatable data.csv -T darkProfessional dark theme with blue accents. Perfect for long reading sessions.
Light Theme
csv-datatable data.csv -T lightClean, bright theme ideal for presentations and printing.
Neon Theme
csv-datatable data.csv -T neonCyberpunk-inspired with neon green and hot pink accents.
Purple Theme
csv-datatable data.csv -T purpleElegant purple gradient theme with a mystical feel.
Ocean Theme
csv-datatable data.csv -T oceanRefreshing ocean-blue theme with aqua accents.
💡 Usage Examples
Example 1: Simple Report
csv-datatable customers.csv -t "Customer List"Example 2: Sales Dashboard
csv-datatable sales_2024.csv \
-t "Q4 Sales Report" \
-T ocean \
-p 50 \
-s "25,50,100,200" \
-o sales-dashboard.htmlExample 3: Large Dataset
csv-datatable bigdata.csv \
-p 100 \
-s "50,100,200,500,-1" \
-T darkNote: Use -1 in page sizes to include "All" option
Example 4: Light Theme for Printing
csv-datatable invoice.csv \
-t "Invoice Details" \
-T light \
-o invoice.htmlExample 5: Compact View
csv-datatable contacts.csv \
-p 10 \
-s "5,10,20,50"📊 Features Breakdown
🔍 Search & Filter
- Global Search: Search across all columns instantly
- Real-time Results: See results as you type
- Keyboard Shortcut: Press
Ctrl/Cmd + Fto focus search
📑 Pagination
- Customizable Sizes: Set your own page size options
- Quick Navigation: First, Previous, Next, Last buttons
- Status Info: Shows "Showing X to Y of Z entries"
- Smart Display: Ellipsis for large page ranges
↕️ Sorting
- Multi-column: Click any header to sort
- Toggle Direction: Click again to reverse sort
- Visual Indicators: Arrows show current sort state
📤 Export Functions
- 📋 Copy: Copy table data to clipboard
- 📊 CSV: Export as CSV file
- 📈 Excel: Export as Excel spreadsheet
- 📄 PDF: Generate PDF (landscape, A2 size)
- 🖨️ Print: Print-optimized view
🎯 Advanced Features
- Fixed First Column: Always visible when scrolling horizontally
- Sticky Headers: Headers stay visible when scrolling vertically
- Cell Tooltips: Hover to see full content of truncated cells
- Responsive Tables: Adapts to screen size
- Keyboard Navigation: Full keyboard support
🗂️ CSV Format Requirements
Supported Format
Header1,Header2,Header3
Value1,Value2,Value3
Value4,Value5,Value6Best Practices
- ✅ First row should contain headers
- ✅ Use UTF-8 encoding
- ✅ Quote fields containing commas:
"Last, First" - ✅ Escape quotes with double quotes:
"He said ""Hello""" - ✅ Keep headers concise and descriptive
File Size Recommendations
- Small (< 1MB): Any page size works
- Medium (1-10MB): Use page sizes 25-100
- Large (> 10MB): Use page sizes 50-200
🎯 Use Cases
- 📈 Data Analysis: Quickly visualize CSV exports
- 📊 Reports: Generate beautiful HTML reports
- 📋 Inventory: Display product catalogs
- 👥 Contact Lists: Manage customer databases
- 💰 Financial Data: Present sales and revenue
- 📚 Education: Share student records
- 🔬 Research: Display experimental data
- 📦 Logistics: Track shipments and orders
🛠️ Technical Details
Dependencies
- DataTables.js v2.0.8 - Table enhancement
- jQuery v3.7.1 - DOM manipulation
- Papa Parse - CSV parsing
- Commander - CLI argument parsing
- JSZip - Excel export support
- PDFMake - PDF generation
Browser Compatibility
- ✅ Chrome 90+
- ✅ Firefox 88+
- ✅ Safari 14+
- ✅ Edge 90+
Performance
- Load Time: < 2s for files up to 5MB
- Search: Real-time with < 50ms delay
- Export: < 5s for 10,000 rows
Custom Page Sizes
# Small increments for detailed analysis
csv-datatable data.csv -s "5,10,15,20"
# Large increments for quick overview
csv-datatable data.csv -s "100,250,500,1000"
# Include "Show All" option
csv-datatable data.csv -s "25,50,100,-1"Customer Database
csv-datatable customers.csv \
-t "Customer Database - 2024" \
-T light \
-p 25 \
-s "10,25,50,100" \
-o customers-report.htmlFinancial Report
csv-datatable transactions.csv \
-t "Q4 Financial Transactions" \
-T purple \
-p 50 \
-s "25,50,100,200" \
-o finance-report.htmlProduct Catalog
csv-datatable products.csv \
-t "Product Catalog 2024" \
-T ocean \
-p 20 \
-s "10,20,50,100,-1"📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- DataTables - Amazing table plugin
- Papa Parse - Fast CSV parser
- Commander.js - CLI framework
- jQuery - JavaScript library
🗺️ Roadmap
- [ ] Add column filtering
- [ ] Support for JSON input
- [ ] Custom column width control
- [ ] Chart integration
- [ ] Row grouping
- [ ] Column visibility toggle
- [ ] Save/load table state
- [ ] Dark mode toggle button
- [ ] More export formats (XML, SQL)
- [ ] API endpoint generation
Made with ❤️ for data enthusiasts
🎓 Tutorial
Step 1: Prepare Your CSV
Name,Email,Department,Salary
John Doe,[email protected],Engineering,120000
Jane Smith,[email protected],Marketing,95000Step 2: Generate Table
csv-datatable employees.csv -t "Employee Directory"Step 3: Customize
csv-datatable employees.csv \
-t "Employee Directory" \
-T purple \
-p 10 \
-s "5,10,20,50"Step 4: Share
Share the generated HTML file with your team - no server required!
📱 Mobile Support
The tables are fully responsive and work great on mobile devices:
- Horizontal scrolling for wide tables
- Touch-friendly controls
- Optimized button sizes
- Responsive page size selector
Try it on your phone! 📱
Last Updated: November 15, 2024
