read cell value in Excel

hello, something weird : when I do a sequence of reading cells in Excel, I get wrong data, even though I see the rigth value in the cell sheet.cells().item(j,i).value().double() → this does ! not always ! return the right value. (sometimes it’s right and sometimes it’s wrong) Is there another way of selecting a cell and reading its value? thx, Kathleen

something extra I discovered (but still no solution for it) : if sheet.cells().item(j,i).value() == VT_EMPTY then sheet.cells().item(j,i).value().double() becomes an arbitrary value. How can I see - in code - if the value is VT_EMPTY, so I can force the result to 0 ? thx, Kathleen

Hi Kathleen, This ‘solution’ might seem a little weird… Have you tried breaking the variable into 3, so that Axapta will read more clearly the desired cell content? Insead of sheet.cells().item(i,j).value().double() use cells = sheet.cells(); cell = cells.item(i,j); realValue = cell.value().double(); I had similar problems with querybuildrange class in the forms’ datasources’ executequery method. These could also have something to do with the format in which the cells values are set is Excel. Regarding the 2nd problem, you can try like this: anytype cellType; ; cellType = cell.value().variantType(); if (cellType == COMVariantType::VT_EMPTY) { … // result = 0 } Regards, CD