My code looks like this:
public void method(String value,int row,int column) throws Exception {
try {
FileInputStream inp = new FileInputStream("C:\\Users\\sit2autouser1\\Desktop\\Newdatasheet.xlsx");
Workbook wb = WorkbookFactory.create(inp);
Sheet sheet = wb.getSheet("Sheet2");
Cell cell = sheet.getRow(row).getCell(column);
String cellContents = value;
// Modify the cellContents here
// Write the output to a file
cell.setCellValue(cellContents);
FileOutputStream fileOut = new FileOutputStream("C:\\Users\\sit2autouser1\\Desktop\\Newdatasheet.xlsx");
wb.write(fileOut);
fileOut.close();
} catch (Exception e) {
throw (e);
}
}
It is throwing error just before close and it is also corrupting the Excel file. I am getting the same error, as soon as it reaches .write function it opens up a new tab which says "Source not found","Edit Source Look up path". And the heading of the tab is Integer.decode(String) line: not available.