Accessing Table from Cell and Adding Values inside it using Row and Column Offsets

Example

Screenshots comparing the source and output files

The following screenshot shows the source Excel file used inside the code. It contains the empty table and highlights the cell D5 which lies inside the table. We will access this table from cell D5 using Cell.getTable() method and then add the values inside it using both Cell.putValue() and ListObject.putCellValue(rowOffset,columnOffset,value) methods.

todo:image_alt_text

The following screenshot shows the output Excel file generated by the code. As you can see cell D5 has a value and cell F6 which is at the offset 2,2 of the table has a value.

todo:image_alt_text

Java code to access table from cell and to add values inside it using row and column offsets

The following sample code loads the source Excel file as shown in the above screenshot and adds values inside the table and generates the output Excel file as shown above.