0.1.1 • Published 5 years ago

@gabrielduumont/react-export-excel v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@gabrielduumont/react-export-excel

React component that will export an array of objects into XLSX

Install

npm install --save @gabrielduumont/react-export-excel

or

yarn add @gabrielduumont/react-export-excel

Usage

import React from 'react';
import { ExcelExporter } from './components';

function App() {
  const data = [
    {
      'Column Title 1': 'Value 1',
      'Column Title 2': 1,
    },
    {
      'Column Title 1': 'Value 2',
      'Column Title 2': 2,
    },
    {
      'Column Title 1': 'Value 3',
      'Column Title 2': 3,
      'Column Title 3': '25-12-2015',
    },
  ];
  return (
    <ExcelExporter
      data={data}
      fileName="Excel Report Name"
      sheetName='Results'
    />
  );
}

export default App;

Props

No props are required, but if you don't provide at least the 'data' props, nothing will happen.

PropRequiredTypeDefault
datanoarray of objects[]
childrennoReact Componentnull
fileNamenostring'Download'
sheetNamenostring'Sheet 1'
disablednoboolfalse
labelnostring'Export' (if there is data to export) / 'No data to export.' (otherwise)
classNamenostring''
minCellWidthnonumber20