Reading an Excel file

In Dynamics AX, retrieving data from Excel files can be done with the help of the same SysExcel classes that we used for creating Excel files. The classes provide a simple interface for developers to access and read data in Excel files.

In this recipe, we will demonstrate how to read Excel files using the SysExcel classes. We will read the customer file created in the previous recipe and display its content in the Infolog.

How to do it...

Carry out the following steps in order to complete this recipe:

  1. In the AOT, create a new job named ReadExcelFile with the following code (replace the file name with your own):
    static void ReadExcelFile (Args _args) { SysExcelApplication excel; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; ...

Get Microsoft Dynamics AX 2012 Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.