We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Excel export with sheet name

Hi all,

Does anybody knows how to export excel document with changing sheet name? I looked on 'ExcelExportProperties' class. Couldn't find any property for that. And I also want add black borders in every cell. Please help to solve those.

Thank you.

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team March 29, 2019 05:22 AM UTC

Hi Neo, 

Greetings from Syncfusion. 

Query #1: Does anybody knows how to export excel document with changing sheet name? 
 
We have analyzed your query and we suggest to refer to the below documentation to change the name of the exported excel sheet, 

                                https://ej2.syncfusion.com/angular/documentation/api/grid/excelExportProperties/ 

Query #2: I also want add black borders in every cell 
 
We suggest to refer to the below documentation to customize the exported excel cells, 

                                https://ej2.syncfusion.com/angular/documentation/api/grid/excelQueryCellInfoEventArgs/ 
                                https://ej2.syncfusion.com/angular/documentation/api/grid/excelStyle/#borders  

Please get back to us for further assistance. 
 
Regards, 
Thavasianand S. 



LO lorryl January 5, 2021 10:11 AM UTC

Hi,

How to change the "sheet1" name if using multi grid export ?



BS Balaji Sekar Syncfusion Team January 6, 2021 12:12 PM UTC

Hi lorryl, 
 
Based on your query we suspect that you want to change the sheet name in exporting excel file. To achieve your requirement we suggest you to use the below code example 
 
  toolbarClick(args) { 
    if (args.item.text == "Excel Export") { 
      const appendExcelExportProperties = { 
        multipleExport: { type: "NewSheet" } 
      }; 
      const firstGridExport = this.fgrid.excelExport( 
        appendExcelExportProperties, 
        true 
      ); 
      firstGridExport.then(workbook => { 
        workbook.worksheets[0].name = "WS1"; // Changed the sheet name 
        const secondGridExport = this.sgrid.excelExport( 
          appendExcelExportProperties, 
          true, 
          workbook 
        ); 
        secondGridExport.then(wb => { 
          wb.worksheets[1].name = "WS2"; // Changed the sheet name 
          const book = new Workbook(wb, "xlsx"); 
          book.save("Export.xlsx"); 
        }); 
      }); 
    } 
  } 
 
 
Regards, 
Balaji Sekar 


Loader.
Live Chat Icon For mobile
Up arrow icon