Excel read in AX2012

I am trying to read values from excel. I am unable to read the integer value, it always returns me 0. While I am able to read strings. Anything wrong with the below code?

SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
int i;

application = SysExcelApplication::construct();
workbooks = application.workbooks();
filename = “C:\Test\Book1.xlsx”;
catch (Exception::Error)
throw error(“File cannot be opened.”);
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();

i = cells.item(2, 1).value().int();
info(strfmt(’%1’, i));

Hi Swapna ,

Use the below line instead of i = cells.item(2, 1).value().int();

i = cells.item(2,1).value().double();

It ll wrk.