In your code, this line HSSFRow row = sheet.createRow((short) 0);
just creates a new row at position 0
. Anything beyond that is still null
and thus will throw a NPE when you try to call any method on it.
To be able to write to a cell in a row, you need to first create a row at the particular position.
HSSFRow row = sheet.createRow(2); // create a row at rownum 2
// use the created row and add/edit cells in it.