Read Excel file using OpenXMLSDK Dynamics 365(AX-7)
Following is code you can use to read Excel using Open XML.
using DocumentFormat.OpenXml;
using System;
using System.Linq;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
public class SLAX7_ImportClass
{
public void testRun()
{
OXMLSpreadsheetDocument_RU document = OXMLSpreadsheetDocument_RU::construct("C:\\AX\\Test.xlsx");
OXMLWorkBook_RU workbook = OXMLWorkBook_RU::construct(document);
OXMLWorksheet_RU worksheet = workbook.getWorksheet(1);
OXMLRow_RU row = worksheet.row(1);
OXMLCell_RU cell = Row.cell(1);
Global::info(strFmt('%1',cell.getValue()));
}
}
No comments:
Post a Comment