2.0.1 • Published 4 months ago

react-excel-exporter v2.0.1

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

React Excel Exporter

Library for exporting data to Excel made with React and ViteJS.

Installation

  • If you are usign yarn:
yarn add react-excel-exporter
  • If you are usign npm:
npm install react-excel-exporter

ExcelFile Props

PropTypeDefaultRequiredDescription
filenamestringnulltrueName of the excel file that will be downloaded
elementReactNodenulltrueElement to download excel file
childrenArray<ExcelSheet>nulltrueExcelSheet Represents data

ExcelSheet Props

PropTypeDefaultRequiredDescription
namestringnulltrueSheet name in file
dataarray<object>nulltrueExcel Sheet data
childrenExcelColumnnulltrueExcelColumns

ExcelColumn Props

PropTypeDefaultRequiredDescription
namestringnulltrueColumn name in file
valuestring or functionnulltrueProperty name to access value

Code Example

import { ExcelFile, ExcelColumn, ExcelSheet } from 'react-excel-exporter'

function App() {
  return (
      <ExcelFile
        element={
          <button>
            download
          </button>
        }
        filename="excel-colors"
      >
        <ExcelSheet 
          name="Colors" 
          data={[
            {
              name: 'Blue',
              is_dark: false,
            },
            {
              name: 'Yellow',
              is_dark: false
            },
            {
              name: 'Pink',
              is_dark: false,
            },
            {
              name: 'Black',
              is_dark: true
            },
          ]}
        >
          <ExcelColumn label="Name" value="name" />
          <ExcelColumn label="Color Dark" value={(col) => col.is_dark ? "Yes" : "False"} />
        </ExcelSheet>
      </ExcelFile>
  )
}
2.0.1

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

2.0.0

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.0.0

1 year ago