Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

data-to-xlsx

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-to-xlsx

Convert data to excel and save

  • 1.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

About

The JSON to Excel data conversion library offers an easy and efficient way to transform data structures from JSON format into Excel spreadsheets. With flexibility and high accuracy, this tool saves time and effort in processing and presenting information. Particularly useful for those working in data analysis and data science fields, it serves as a valuable asset in managing and analyzing data effectively.

Installation

Install npm

npm i data-to-xlsx

Additional typescript definitions

npm i @types/data-to-xlsx --save-dev

Demo

A minimal demo page can be found in src directory. Online demo is also available!

Import


import convertDataToExcel from 'data-to-xlsx';
const convertDataToExcel = require("data-to-xlsx")

Examples


Using convertDataToExcel in ReactJs

import convertDataToExcel from 'data-to-xlsx';

const App = () => {
    const onDownload = () => {
        convertDataToExcel({
            data: [
              {
                Index: 1,
                Name: "Jindo Katory",
                Age: 18
              },
              {
                Index: 2,
                Name: "Katory Jindo",
                Age: 17
              },
            ],
            fileName: "example"
        })
    }

    return(
        <button onClick={onDownload}>Download</button>
    )
}

export default App;

API

PropsTypeRequireDefault valueDescription
dataObject[]YesValues of table in file excel
fileExtension.xlsx, .xlsNo.xlsxThe file type will be downloaded after conversion
startCellOfDatastringNoA1The starting cell name of the data when saved in the excel file
colsGroupIColsGroup[]NoUse to group specific cells in a file
sheetNamestringNoSheet 1Name of the sheet file
colWidthsnumber[]NoThe size of the columns in the file starts from the first column (A)
rowHeightsnumber[]NoThe size of the rows in the file starts from the first row (1)
fileNamestringNoexampleThe name of the file after it is downloaded
isBorderedbooleanNofalseDetermines whether to fill the data cells with borders
stylesIStyle[]NoStyle for cells in the file

In the data of data elements, the keys in the object are used as the header of the data table

IColsGroup

PropsTypeRequireDefault valueDescription
contentstringYesContent of cell group
originstringYesThe starting cell name of the cell group
colStartnumberYesColumn numbers start from 0
colEndnumberYesColumn number end
rowStartnumberYesRow numbers start from 0
rowEndnumberYesRow numbers end from 0

In case you only want to group in the same row or same column, you can configure the parameters colStart = colEnd, rowStart = rowEnd

IStyle

PropsTypeRequireDefault valueDescription
rowStartnumberYesRow numbers start from 0
rowEndnumberYesRow numbers end
colStartnumberYesColumn numbers start from 0
colEndnumberYesColumn number end
typeb, e, n, d, s, zNosCell value type
formatnumberNoFormat cell values
styleCell Style PropertiesNoConfigure the style of the cell

Keywords

FAQs

Package last updated on 09 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc