How to insert a row between two rows in an existing excel with HSSF (Apache POI)

Helper function to copy rows shamelessly adapted from here import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.util.CellRangeAddress; import java.io.FileInputStream; import java.io.FileOutputStream; public class RowCopy { public static void main(String[] args) throws Exception{ HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(“c:/input.xls”)); HSSFSheet sheet = workbook.getSheet(“Sheet1”); copyRow(workbook, sheet, 0, 1); FileOutputStream out = new FileOutputStream(“c:/output.xls”); workbook.write(out); out.close(); } private static void … Read more