Questions tagged [sheetjs]

A pure JavaScript library to read, parse, edit, and write spreadsheets, or to convert them to different formats like JSON.

You can find more information at

277 questions
27
votes
3 answers

How to convert a nested json object into an excel table using the xlsx npm library?

I've got a nested json object. For the sake of simplicity: data = {'key1': 1, 'key2': 2, 'key3': {'nestedKey1': 3, 'nestedKey2': 4}} A real object is bigger but the point is that it's a nested one. Values may be strings, numbers or other…
GoBear
  • 518
  • 1
  • 5
  • 19
27
votes
6 answers

SheetJS xlsx-cell styling

I am referring this example to export a worksheet https://github.com/SheetJS/js-xlsx/issues/817. How to do cell styling like background coloring,font size and increasing the width of the cells to make the data fit exactly.I have gone through the…
GrailsLearner
  • 485
  • 1
  • 11
  • 23
26
votes
1 answer

sheetjs xlsx, How to write merged cells?

I need to create a xlsx with merged cells using sheetjs. data: [ { "id": "nick", "items": [ { "name": "ball" }, { "name": "phone" } ] }, { "id": "jack", "items": [ { …
chacker
  • 315
  • 1
  • 4
  • 8
24
votes
8 answers

Format date with SheetJS

Thank you in advance for taking a look at this question! I am trying to use SheetJS to read a .xlsx file but am having some trouble with a column of dates that is formatted via Excel as Custom "yyyy/mm/dd hh:mm:ss". All of these dates show up as…
sivs
  • 677
  • 1
  • 5
  • 11
22
votes
5 answers

SheetJS json_to_sheet renaming headers

I have an array of objects. By default, sheet_to_json uses object keys as headers. However, I need to rename those headers without explicitly modifying my array of objects. Is this possible?
Kay Singian
  • 1,301
  • 8
  • 20
  • 33
15
votes
2 answers

Multiple tables in single sheet using sheetJS

I am successfully using the example from sheetJS's website, like so: /* create new workbook */ var workbook = XLSX.utils.book_new(); /* convert table 'table1' to worksheet named "Sheet1" */ var ws1 =…
AussieJoe
  • 1,285
  • 1
  • 14
  • 29
12
votes
2 answers

How to write into a particular cell using xlsx npm package

I have to write a value to a particular cell (say the D4 cell) in my xlsm file. I can see the option of XLSX.writeFile(workbook, 'out.xlsx'); in the XLSX package documentation (writing functions) But I am not seeing anything to write a value to a…
Ashish
  • 161
  • 1
  • 2
  • 10
12
votes
2 answers

How to add cell border to SheetJS .xlsx generated file?

I have a SheetJS .xlsx generated file, but I have not been able to put border to the cells. I have this: And I need this: Is there a way to do it with SheetJS? It will be cool if there's a way to apply another cell styles, like background…
8
votes
1 answer

SheetJS How to create sheet from json and save it as buffer

Documentations seems confusing to me. How can i create a document from a array of objects, each object representing a row and save it as buffer?
8
votes
1 answer

Export to excel with React and SheetJS

I am trying to implement export to excel with React and SheetJs library. Looks like I can download it, but the actual output does not look as expected. I receive array of object and use XLSX.utils.json_to_sheet([data]) API to converts an array of…
Palaniichuk Dmytro
  • 2,943
  • 12
  • 36
  • 66
7
votes
0 answers

How do I append XLSX data to existing worksheet using SheetJS?

I am currently using NodeJS and the library SheetsJS to read an XLSX workbook. My task is to take data from multiple sheets and append them to a new worksheet. The structure of the sheet has the Categories in Column A and Category Values in Column…
hello_there
  • 209
  • 1
  • 5
  • 10
7
votes
2 answers

How to freeze a pane in an Excel table using SheetJS?

I use SheetJS to make an Excel table in my node.js application: const xlsx = require('xlsx'); const workbook = xlsx.utils.book_new(); const worksheet = xlsx.utils.aoa_to_sheet([ ['Number', 'Name', 'Value'], [1, 'Bill', 1500], [2,…
Finesse
  • 9,793
  • 7
  • 62
  • 92
7
votes
1 answer

How to parse, and iterate through, all rows from an Excel sheet file using JavaScript

I am trying to parse and read every cell from an Excel sheet; it seems that I am parsing the file but I just can't go through each cell and display them. I am using the following code: var workbook = XLSX.read('datasets/persons.xlsx', { type:…
Mizlul
  • 1
  • 7
  • 41
  • 100
6
votes
1 answer

Date in XLSX file not parsing correctly in SheetJs

I am trying to read a XLSX file using sheetjs node-module with a column having dates. After parsing I got data in incorrect format File data is : 2/17/2020 But after xlsx read it gives me 2/17/20. It is changing the year format. My requirement is to…
user13000875
  • 387
  • 2
  • 14
6
votes
1 answer

Convert .xlsx file with merged cells to JSON with SheetJS

I'm trying to read a .xlsx file with SheetJS and convert it into JSON. I'm able to read and convert a simple (without merged cells) .xlsx file to JSON, but I'm not getting it right with merged cells. The problem is that I have a .xlsx file with…
Doodle
  • 141
  • 2
  • 9
1
2 3
18 19