简体   繁体   中英

How to read an excel file uploaded and convert to json in angular

Can some one help on How to read an excel file uploaded and convert to json in angular. Thank you.

https://www.npmjs.com/package/read-excel-file use this npm package.

Install

npm install read-excel-file --save

In html

<input type="file" id="input" />

ts

import readXlsxFile from 'read-excel-file'

const input = document.getElementById('input')

input.addEventListener('change', () => {
  readXlsxFile(input.files[0]).then((rows) => {
    // `rows` is an array of rows
    // each row being an array of cells.
  })
})

Demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM