Socket
Book a DemoInstallSign in
Socket

@ailnaf/xlsx2csv

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ailnaf/xlsx2csv

convert xlsx to csv

1.3.8
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

xlsx2csv

xlsx2csv for browser and nodejs with performance considered

demo

Install

npm i @ailnaf/xlsx2csv

Usage

esm

import xlsx2csv from '@ailnaf/xlsx2csv'

cdn

<script src="https://unpkg.com/@ailnaf/xlsx2csv/xlsx2csv.min.js"></script>

cjs

const { default: xlsx2csv } = await import('@ailnaf/xlsx2csv')

nodejs


const filename = 'data.xlsx'

xlsx2csv(filename, console.log)

browser

const buffer = await fetch('data.xlsx').then(res => res.blob())

xlsx2csv(buffer, console.log, { sheet: { max: 100 } })

// [ 'hello', 'world' ]
// [ 'bar', 'foo' ]


const rows = await xlsx2csv(buffer, null, { sheet: { max: 100, collect: true } })
console.log(rows)

// [ [ 'hello', 'world' ], [ 'bar', 'foo' ] ]

const rows = await xlsx2csv(buffer, null, { sheet: { max: 100, collect: true, json: true } })
console.log(rows)

// [ { hello: 'bar', world: 'foo' } ]

export xlsx

for small files browser and nodejs

import csv2xlsx from '@ailnaf/xlsx2csv/csv2xlsx'

const source = [
    ['number1', 'number2', 'hello', 'number3', null, 'date', 'list'],
    [12.7, 12.8, 'world', '100', null, new Date(), [1,2,3]],
]

csv2xlsx(source)
.then(buf => {
    console.log(buf)
})
.catch(console.log)

Test

# all data
node test.js data.xlsx

# 1 row
node test.js data.xlsx 1

License

MIT

Keywords

xlsx

FAQs

Package last updated on 16 Dec 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.