Inserting new column in existing xls file keeping the format intact In Java

287 Views Asked by At

I want to insert a new column in between the existing columns of the excel which is in .xls format using Java retaining the existing format. Is there any api to do so?

1

There are 1 best solutions below

0
On BEST ANSWER

You can use the Apache POI library to modify an Excel file.

Quick Guide: https://poi.apache.org/components/spreadsheet/quick-guide.html

You'll want to:

  • Load your Excel file as a Workbook.
  • Open the correct Sheet.
  • Insert your new column using Sheet#shiftColumns.
  • Save the modified Workbook back to an Excel file.