We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cells.convertStringToNumericValue() method on subset of cells


I need to invoke the Cells.convertStringToNumericValue() method to avoid the error notifications on cells that hold numeric like value. But I need this done only on few cells and not on all the cells in the work-sheet. How do I do this?

Cells object can be obtained from worksheet object which encapsulates all the cells. How do I do this on a sub-set of cells?

Any alternative to using convertStringToNumericValue().? Unfortunately the api docs are not that informative I must say.

  • Raj A


Thanks for your good question and considering Aspose.Cells.

Alternatively, you can use Cell.putValue(string, boolean) method for this purpose. When the second parameter is set to true, then Aspose.Cells tries to convert the string value into appropriate data type like integer.

Please check the following sample code, its source excel file and the output excel file. Please check the cell A1 in the source excel file, it was a string but after the execution of the code, it has become integer.

String filePath = “D:\Downloads\source.xlsx”;

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.getWorksheets().get(0);

Cell a1 = worksheet.getCells().get(“A1”);

a1.putValue(a1.getStringValue(), true);


Thank you for your reply. The overloaded putValue methods did help.


Good to know that your issue is sorted out now. Feel free to contact us any time if you need further help or have some other issue, we will be happy to assist you soon.

Thank you.