How to display an header and its row values as the last column contents using SheetJS RRS feed

  • Question

  • have used npm package xlsx to import a json string to an excel sheet.

    I have exported json to excel using XLSX.utils.sheet_to_json and the output has headers in the below order

    1) EventType 2) StartDate 3) EndDate 4) DurationName 5) Eqp1 6) Eqp2 7) Eqp3 8) Total 9) Eqp4

    I would like to display 'Total' and its contents as the last column. How can I achieve that?

    Please note that I cannot order all the columns as some columns are dynamic and varies from one situation to another. For the common ones, I have already added header order. My requirement is to display the below headers first, then the dynamic ones followed by total. Total should always be in the end.

    const headerInfo = ['Event Type', 'Start Date', 'End Date', 'Duration Name']; const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json, { header: headerInfo });

    Please help

    Tuesday, April 9, 2019 11:00 AM

All replies

  • Hi

    Thank you for posting here.

    Since this thread is related to npm package, it is a third-party product.

    You could post in the following forum.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, April 10, 2019 1:52 AM