2

I have a button to export a excel file with the data(JSON format). I can able to do for one table but I want to have multiple tables(different datasset-JSON) in the same excel sheet and export that file as shown below.

enter image description here

I'm using exceljs and file-saver with angular2 in node environment. please guide me with the right approach. Thanks in advance.

Aarthi Chandrasekaran
  • 569
  • 2
  • 10
  • 21

1 Answers1

3

I had a similar question and got the answer to it - Angular xlsx - multiple json to sheet

Your case is a bit different as you need to play around with merging cells, but there is the option to create the second json with empty props like:

let obj = { Name: 'Johnson', '': '', Age: 32, '', '' } 

Not pretty and not ideal as it will only fit the format of the columns. However there are few ideas on the web for merges - https://github.com/SheetJS/js-xlsx/issues/416

Hope this helps.

Kris Bonev
  • 552
  • 1
  • 3
  • 16