Buzzer
Buzzer

Reputation: 327

How to avoid automatic data formatting of Big Number in Excel

I am running a Spring Batch job to generate a CSV file having some customer information. When file generates customer's phone number is listed as 322857260002; upon opening up the file, you'll have the number shown as 3.22858E+11. I want to see the complete number in file(322857260002)

unmatchedItem.setMpsReference(rs.getString("MPS_REFENRECE"));

mpsReferenceNumber is as String in the UnmatchedItem object. I have tried BigInteger also but the issue still remains.

Please help me and let me know in case if you need more information.

Regards

Upvotes: 0

Views: 220

Answers (2)

Golam Mazid Sajib
Golam Mazid Sajib

Reputation: 9447

You can also read it to convert from double to Bigdecimal.

if XSSFCell.CELL_TYPE_NUMERIC:
Double doubleValue = nextCell.getNumericCellValue();
BigDecimal bd = new BigDecimal(doubleValue.toString());

Upvotes: 0

Steve11235
Steve11235

Reputation: 2923

The issue lies with Excel, not with your CSV file. Try changing the format of the offending cells to a specific numeric format.

Upvotes: 2

Related Questions