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

antd-spreadsheet-import

v0.0.14

Published

A lightweight React component for importing and mapping Excel/CSV files with ease. Built with **Ant Design** and **SheetJS**, it provides a multi-step modal interface to upload, select sheets, map columns, and preview data before final import.

Readme

antd-spreadsheet-import

A lightweight React component for importing and mapping Excel/CSV files with ease. Built with Ant Design and SheetJS, it provides a multi-step modal interface to upload, select sheets, map columns, and preview data before final import.

✨ Features

  • ✅ Upload Excel (.xlsx) and CSV files
  • ✅ Select sheets from workbooks
  • ✅ Auto-detect and map columns to fields
  • ✅ Support for required and custom fields
  • ✅ Alternate column name matching (e.g., "mail" matches "email")
  • ✅ Real-time data preview with pagination
  • ✅ Multi-step modal workflow (Upload → Preview)
  • ✅ Built with Ant Design for polished UI
  • ✅ Fully customizable field mappings
  • ✅ i18n support (internationalization ready)

📦 Installation

npm

npm install antd-spreadsheet-import

yarn

yarn add antd-spreadsheet-import

pnpm

pnpm add antd-spreadsheet-import

🚀 Quick Start

import { useState } from "react";
import { ExcelImporter } from "antd-spreadsheet-import";
import { Button } from "antd";

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

  const fields = [
    {
      label: "Name",
      key: "name",
      alternateMatches: ["full name", "first name"],
      validations: [
        {
          rule: "required",
          errorMessage: "Name is required",
        },
      ],
    },
    {
      label: "Email",
      key: "email",
      alternateMatches: ["mail", "email address"],
      validations: [
        {
          rule: "required",
          errorMessage: "Email is required",
        },
      ],
    },
    {
      label: "Phone",
      key: "phone",
      alternateMatches: ["mobile", "contact number"],
    },
  ];

  const handleSubmit = async (contacts) => {
    console.log("Imported contacts:", contacts);
    // Send to your API or database
    return { success: true, message: "Data imported successfully" };
  };

  return (
    <>
      <Button type="primary" onClick={() => setOpen(true)}>
        Import Excel
      </Button>

      {open && (
        <ExcelImporter
          isOpen={open}
          onClose={() => setOpen(false)}
          onSubmit={handleSubmit}
          fields={fields}
          modalWidth={800}
          tableSize={"middle"}
          translations={{
            title: "Upload Excel",
            uploadFileText: "Upload File",
            reupload: "Reupload",
            sheetDropdownLabel: "Sheet",
            sheetsText: "Sheets",
            rowsFoundText: "Rows",
            uploadingText: "Uploading",
            tab: {
              upload: "Upload",
              preview: "Preview",
            },
            mappingAlertText: {
              heading: "Not all columns mapped",
              message: "There are required columns that are not mapped yet.",
              notMappedText: "Columns not mapped",
            },
            buttons: {
              cancel: "Cancel",
              import: "Import",
              back: "Back",
              next: "Next",
            },
            columns: {
              tableColumn: "Table Columns",
              mapField: "Mapping To",
              columns: "Columns",
            },
            table: {
              title: "Mapped Data",
              sn: "SN",
            },
            dropdownPlaceholder: {
              selectField: "Select Field",
            },
            alerts: {
              noRows: "No rows found in this sheet",
              noMappingFound: "No Column Mapping Found",
              noSheet: "No Sheet Found",
            },
          }}
        />
      )}
    </>
  );
}

export default App;

📚 API Documentation

<ExcelImporter /> Props

| Prop | Type | Required | Description | | -------------- | ------------------------------------- | -------- | -------------------------------------- | | isOpen | boolean | ✅ | Controls modal visibility | | onClose | () => void | ✅ | Callback when user closes modal | | onSubmit | (data: object[]) => void \| Promise | ✅ | Callback with imported/formatted data | | fields | Field[] | ✅ | Required fields for mapping | | translations | Translations | ❌ | i18n translation object for UI text | | modalWidth | number | ❌ | Modal width in pixels | | tableSize | "small" \| "middle" \| "large" | ❌ | Table size variant (default: "middle") |