Socket
Socket
Sign inDemoInstall

data-to-xlsx

Package Overview
Dependencies
78
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    data-to-xlsx

Convert data to excel and save


Version published
Weekly downloads
11
decreased by-54.17%
Maintainers
1
Install size
24.7 MB
Created
Weekly downloads
 

Readme

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

Last updated on 09 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc