I have an excel file which contains several columns. The columns includes data. I need to add an ID column and generate ID values for each row. I inserted ID column by hand and I've an algorithm to generate ids. But I don't know how to modify empty cells by using JXL? I think, there should be such a function emptyCell.setString() I guess, but it does not exist. Any way to modify an empty cell? Any help appriciated.
Straighot from the official tutorial
Copying and Modifying Spreadsheets
[...]
Once we have a writable interface to the workbook, we may retrieve and modify cells. The following code fragment illustrates how to modify the contents of a label cell located in cell B3 in sheet 2 of the workbook.
WritableSheet sheet2 = copy.getSheet(1);
WritableCell cell = sheet2.getWritableCell(1, 2);
if (cell.getType() == CellType.LABEL)
{
Label l = (Label) cell;
l.setString("modified cell");
}
There is no need to call the add() method on the sheet, since the cell is already present on the sheet. The contents of numerical and date cells may be modified in a similar way, by using the setValue() and setDate() methods respectively.