npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

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)

Readme

📊 CSV to DataTable Generator

Transform your CSV files into beautiful, interactive HTML tables with advanced features and stunning themes.

Version License Node

✨ 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

cars

📦 Installation

Global Installation (Recommended)

npm install -g csv-to-datatable

🚀 Quick Start

Basic Usage

csv-datatable data.csv

This 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 dark

Professional dark theme with blue accents. Perfect for long reading sessions.

Light Theme

csv-datatable data.csv -T light

Clean, bright theme ideal for presentations and printing.

Neon Theme

csv-datatable data.csv -T neon

Cyberpunk-inspired with neon green and hot pink accents.

Purple Theme

csv-datatable data.csv -T purple

Elegant purple gradient theme with a mystical feel.

Ocean Theme

csv-datatable data.csv -T ocean

Refreshing 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.html

Example 3: Large Dataset

csv-datatable bigdata.csv \
  -p 100 \
  -s "50,100,200,500,-1" \
  -T dark

Note: 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.html

Example 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 + F to 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,Value6

Best 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.html

Financial Report

csv-datatable transactions.csv \
  -t "Q4 Financial Transactions" \
  -T purple \
  -p 50 \
  -s "25,50,100,200" \
  -o finance-report.html

Product 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

🗺️ 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,95000

Step 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