Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2515
How to use igGridExcelExporter to add data to an existing Excel file
posted

The igGridExcelExport permits exporting a grid to a new Excel file. Is it possible to add the data as a worksheet to an existing Excel file?

Parents
  • 280
    Verified Answer
    Offline posted

    Hi Ray,

    I found another more clean approach for exporting the grid to an existing excel file, without iterating through the whole worksheet.

    You can bind to the headerCellExporting event of the igGridExcelExporter and add the following code snippet:

                            headerCellExporting: function(sender, args) {
                                var headerArr = [];
                                // We will save all the headers coming to our array for retrieval later on
                                headerArr.push(args.headerText);
                                if (args.columnIndex === 0) { 
                                    sender._workbook = workbook;
                                    sender._worksheet = sender._workbook.worksheets(1);
                                } 
                            }

    Here is a sample for your reference:

    igGridExcelExportToExistingFile (2).zip

    Please, let me know if you have any questions.

    Best regards,
    Hristo Popov

Reply Children
No Data