{"_id":"@code530pro/react-json2excel","name":"@code530pro/react-json2excel","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@code530pro/react-json2excel","version":"0.1.1","description":"Download the json as excel","main":"dist/index.js","module":"dist/index.es.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"rollup -c"},"author":{"name":"code530pro"},"repository":{"type":"git","url":"https://github.com"},"homepage":"https://www.linkedin.com/in/hugo345?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app","license":"MIT","devDependencies":{"@babel/core":"^7.14.6","@rollup/plugin-node-resolve":"^13.0.0","babel-loader":"^8.2.2","react":"^18.3.1","react-dom":"^18.3.1","rollup":"^2.53.1","rollup-plugin-babel":"^4.4.0","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-postcss":"^4.0.0","rollup-plugin-terser":"^7.0.2"},"peerDependencies":{"file-saver":"^2.0.5","react":"^18.3.1","react-dom":"^18.3.1","exceljs":"^4.4.0"},"keywords":["react","json","excel","download excel","download json","react json to excel","json to excel"],"_id":"@code530pro/react-json2excel@0.1.1","gitHead":"b4ba58061e767c53919483baf0bc386868241e6f","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-JFWHdXeFpxsQvfjGCulnRyXJcurWGEq1Wv8+wN3fbHIi6XZdpptE9LPiu6xFMa4oMUygkQ9bKSNjZq4jmEabpQ==","shasum":"33b760316d906475088fcf50abeb0c59ebadac91","tarball":"https://registry.npmjs.org/@code530pro/react-json2excel/-/react-json2excel-0.1.1.tgz","fileCount":8,"unpackedSize":11430,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDogoKx/fIs+lfZXyBo63z00n3+HNFFUJnZtcUOn3I9bAiB8FPw/9iTJkgPn1NnlJRgweaFPdjpvXeiudayv/EiKGw=="}]},"_npmUser":{"name":"code530pro","email":"code530pro@outlook.com"},"directories":{},"maintainers":[{"name":"code530pro","email":"code530pro@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-json2excel_0.1.1_1758311152556_0.2205714817839346"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-19T19:45:52.414Z","0.1.1":"2025-09-19T19:45:52.754Z","modified":"2025-09-19T19:45:53.125Z"},"maintainers":[{"name":"code530pro","email":"code530pro@outlook.com"}],"description":"Download the json as excel","homepage":"https://www.linkedin.com/in/hugo345?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app","keywords":["react","json","excel","download excel","download json","react json to excel","json to excel"],"repository":{"type":"git","url":"https://github.com"},"author":{"name":"code530pro"},"license":"MIT","readme":"# React json2excel\n\nA simple and flexible React library for exporting JSON data to Excel files. Allows exporting data through a customizable button component or via a direct function.\n\n## Install\n\n```\nnpm install react-json2excel\n```\n\n\n\n## Using Button Component\n\n```js\nimport { JsonToExcel } from \"react-json2excel\";\n\nclass SmapleComponent extends Component {\n  render() {\n    return (\n      <JsonToExcel\n        title=\"Download as Excel\"\n        data={[{ test: \"test\" }]}\n        fileName=\"sample-file\"\n        btnClassName=\"custom-classname\"\n      />\n    );\n  }\n}\n```\n\n## Usage\n\n```import React from 'react';\nimport { JsonToExcel } from \"react-json2excel\";\n\n// Sample data - product inventory\nconst productInventory = [\n  { id: 1, name: \"Gaming Laptop\", category: \"Technology\", price: 1200, stock: 15 },\n  { id: 2, name: \"Smartphone XL\", category: \"Technology\", price: 800, stock: 22 },\n  { id: 3, name: \"Bluetooth Headphones\", category: \"Audio\", price: 150, stock: 30 }\n];\n\n// Sample data - employees\nconst employeeData = [\n  { id: \"E001\", name: \"Maria Garcia\", department: \"Sales\", salary: 45000, tenure: 3 },\n  { id: \"E002\", name: \"Carlos Rodriguez\", department: \"IT\", salary: 55000, tenure: 5 },\n  { id: \"E003\", name: \"Ana Martinez\", department: \"Marketing\", salary: 42000, tenure: 2 }\n];\n\nconst App = () => {\n  return (\n    <div>\n      <h1>Export Data to Excel</h1>\n      \n      <JsonToExcel\n        title=\"Download Inventory\"\n        data={productInventory}\n        fileName=\"product-inventory\"\n        btnClassName=\"btn-primary\"\n      />\n      \n      <JsonToExcel\n        title=\"Export Employees\"\n        data={employeeData}\n        fileName=\"employee-data\"\n        btnColor=\"#2196F3\"\n      />\n    </div>\n  );\n};\n\nexport default App;\n```\n\n## Using exportToExcel Method\n\n```\nimport React from 'react';\nimport { exportToExcel } from 'react-json2excel';\n\n// Monthly sales data\nconst monthlySales = [\n  { month: \"January\", sales: 12500, customers: 45, region: \"North\" },\n  { month: \"February\", sales: 14300, customers: 52, region: \"North\" },\n  { month: \"March\", sales: 16800, customers: 61, region: \"South\" }\n];\n\nconst SalesReport = () => {\n  const handleDownload = () => {\n    exportToExcel(monthlySales, 'monthly-sales-report');\n  };\n\n  return (\n    <button onClick={handleDownload} className=\"download-btn\">\n      Generate Sales Report\n    </button>\n  );\n};\n\nexport default SalesReport;\n\n```\n\n## Using exportToExcel Method For Multiple sheets\n- Data object should be as below \n- exportToExcel(data, 'downloadfilename', true ) - should pass true\n\n```\nimport React from 'react';\nimport { exportToExcel } from 'react-json2excel';\n\nconst MultiSheetExport = () => {\n  // Data organized by sheets\n  const reportData = [\n    {\n      sheetName: \"Sales\",\n      details: [\n        { product: \"Laptop\", quantity: 15, total: 18000 },\n        { product: \"Tablet\", quantity: 23, total: 11500 },\n        { product: \"Smartphone\", quantity: 42, total: 33600 }\n      ]\n    },\n    {\n      sheetName: \"Customers\",\n      details: [\n        { name: \"TechCorp\", contact: \"John Perez\", value: 25000 },\n        { name: \"InnovateSA\", contact: \"Maria Lopez\", value: 18000 },\n        { name: \"DigitalMinds\", contact: \"Carlos Ruiz\", value: 32000 }\n      ]\n    },\n    {\n      sheetName: \"Summary\",\n      details: [\n        { metric: \"Total Sales\", value: 63100, trend: \"+15%\" },\n        { metric: \"Active Customers\", value: 35, trend: \"+8%\" },\n        { metric: \"Best Selling Product\", value: \"Smartphone\", trend: \"+22%\" }\n      ]\n    }\n  ];\n\n  const handleMultiSheetDownload = () => {\n    exportToExcel(reportData, 'complete-report', true);\n  };\n\n  return (\n    <button onClick={handleMultiSheetDownload} className=\"multi-sheet-btn\">\n      Download Complete Report\n    </button>\n  );\n};\n\nexport default MultiSheetExport;\n\n```\n\n## PROPTYPES\n\n| Prop         | Type   | Info                                                     |\n| ------------ | ------ | -------------------------------------------------------- |\n| title        | String | name of the button                                       |\n| btnClassName | String | class name added to the the button for css customization |\n| data         | Array  | array of objects                                         |\n| fileName     | String | download file name                                       |\n| btnColor     | String | color of button defatlt to #4CAF50                       |\n\n##  License\n react-json2excel is licensed under the MIT License.\n\n## Contacto\n\n[LinkedIn](https://www.linkedin.com/in/hugo345?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app) hugo aragon\n","readmeFilename":"README.md","_rev":"1-0be1d69170e3fdd07be0134af1d5e829"}