Create Excel Sheet in D365 F&O

Hi All,

I need to create one EXCEL sheet through X++ where the format for the file should be ".XLS" Also there there is a summery need to create at the end of lines. 

I have Created the sheet but it's coming in "File" format. As SYsExcelapplication class has been deprecated by the Microsoft so how we could achieve this in current system.

Here is the file format need to create 

  • Rather than developing it from scratch by yourself, wouldn't it be both easier and more powerfull if you use the exesting feature of templates for Open in Excel? You can find more information on internet, e.g. here and here.

    If you decide that you need your own code anyway, check out this example:

    using OfficeOpenXml;
    class Demo
        public static void main(Args _args)
            using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                using (var package = new ExcelPackage(stream))
                    ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Sheet1");
                    ExcelRange cell = worksheet.Cells.get_Item(1,1);
                    cell.Value = 'Record type';
                File::SendFileToUser(stream, 'data.xlsx');

    Note that I have no idea what you mean by it's coming in "File" format.