Start the table from a specific column excel apache poi

667 Views Asked by At

I'm having a problem in excel while using Apache POI. I can create rows, but sometimes I'm in a situation where I would like to start from a particular column only.

So is it possible to start any particular column like the 'C' column Instead of the column 'A' Always.

I'm using the Java language for this.

Sheet sheet = workbook.createSheet("Sheet 1");
  Row header = sheet.createRow(0);
  header.createCell(0).setCellValue("Header 1");

Click here to see image of excel file

1

There are 1 best solutions below

0
Mikita Berazouski On

Looks like you provide the number of column as a parameter and in your case this is column #0. If you would like to work with third column just change the number of column: header.createCell(2).setCellValue("Header 1");

More about usage of this method you can read in javadoc here.