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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-bulk-excel-import

v0.5.2

Published

One-line Excel/CSV bulk import for React — built-in modal UI with validation preview, error highlighting and progress. Headless hook also included.

Readme

react-bulk-excel-import

npm version npm downloads license

Add "Import from Excel" to your React app in one line. 📄→✅

A ready-made import modal with drag & drop, validation preview (green/red rows), error messages, template download and progress bar — all built in. Zero setup, zero CSS files.

npm install react-bulk-excel-import

That's it. xlsx is bundled — nothing else to install.

One-line usage

import { ExcelImporter } from "react-bulk-excel-import";

<ExcelImporter
  open={open}
  onClose={() => setOpen(false)}
  columns={[
    { header: "Name", key: "name", required: true },
    { header: "Email", key: "email", required: true },
    { header: "Age", key: "age", transform: (v) => Number(v) },
  ]}
  onImport={async (rows) => {
    await fetch("/api/users/bulk", { method: "POST", body: JSON.stringify(rows) });
  }}
/>

Full working example:

import { useState } from "react";
import { ExcelImporter } from "react-bulk-excel-import";

function App() {
  const [open, setOpen] = useState(false);

  return (
    <>
      <button onClick={() => setOpen(true)}>Import Users</button>

      <ExcelImporter
        open={open}
        onClose={() => setOpen(false)}
        title="Import Users"
        columns={[
          { header: "Name", key: "name", required: true },
          {
            header: "Email",
            key: "email",
            required: true,
            validate: (v) => (String(v).includes("@") ? null : "Invalid email"),
          },
          { header: "Age", key: "age", transform: (v) => Number(v) },
        ]}
        onImport={async (rows) => {
          await fetch("/api/users/bulk", {
            method: "POST",
            headers: { "Content-Type": "application/json" },
            body: JSON.stringify(rows),
          });
        }}
        onComplete={(count) => alert(`${count} users imported!`)}
      />
    </>
  );
}

What users see

  1. Drop zone — drag & drop or click to browse (.xlsx / .xls / .csv)
  2. Download template button — auto-generated from your columns
  3. Preview table — every row checked, invalid rows highlighted red with the exact error
  4. Import button — only valid rows are sent, in batches, with a live progress bar
  5. Done screen 🎉

Why this instead of writing it yourself?

Hand-rolling this feature means ~300 lines: SheetJS parsing, header matching (Email vs email vs E-mail), per-cell validation, error UI, batching, progress. With this library you write only your columns and your API call.

How much data can it handle?

  • Default limit: 5,000 rows per file (change with maxRows: 20000)
  • 10k–20k rows parse comfortably in modern browsers
  • Rows are sent to your API in batches of 50 by default (batchSize to change, Infinity for a single call)

ExcelImporter props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | open | boolean | — | Show/hide the modal | | onClose | () => void | — | Close handler | | columns | ColumnDef[] | — | Your column definitions (see below) | | onImport | (rows, ctx) => Promise | — | Your API call. Throw to show an error | | title | string | "Import from Excel" | Modal heading | | accentColor | string | #2563eb | Buttons & progress bar color | | showTemplateDownload | boolean | true | Show the template button | | onComplete | (count) => void | — | Called after successful import | | validateRow | (row, ctx) => errors | — | Cross-row rules (e.g. duplicates in file) | | batchSize | number | 50 | Rows per onImport call | | maxRows | number | 5000 | Max rows per file | | sheet | number \| string | first sheet | Which sheet to read |

Column options

| Option | Description | | --- | --- | | header | Header text in the sheet. Aliases supported: ["Email", "E-mail"]. Case/space-insensitive | | key | Field name in your output objects | | required | Error when the cell is empty | | transform | Convert the value: (v) => Number(v) | | validate | Return an error string, or null if valid |

Advanced: build your own UI (headless hook)

Want full control over the design? Use the same engine without the modal:

import { useBulkImport } from "react-bulk-excel-import";

const { status, rows, validRows, invalidRows, fileError, progress, parseFile, importRows, reset } =
  useBulkImport({ columns, onImport });

You get parsed rows, valid/invalid splits, errors and progress — render them however you like. See the full type definitions for the complete API.

Features

  • One-line modal — drag & drop, preview, errors, progress, all included
  • 📥 Template download — auto-generated from your column definitions
  • 🔤 Smart header matchingEmail / email / E_MAIL all work
  • 3 validation layers — required → per-column → cross-row
  • 📦 Batched imports with live progress
  • 🎨 Headless hook for custom UIs
  • 🟦 TypeScript-first, ESM + CJS

Links

License

MIT