Click here to Skip to main content
13,800,661 members
Rate this:
Please Sign up or sign in to vote.
See more:
The below overwrites the existing sheet. But not create a new sheet.

What I have tried:

File f= new File(System.getProperty("user.dir")+"\\src\\test\\resources\\Exceldata.xls");		
		HSSFWorkbook workbook = new HSSFWorkbook();			
		HSSFSheet worksheet= workbook.createSheet("Sheet4");		
		HSSFRow row = worksheet.createRow(1);
		HSSFCell cell= row.createCell(1);
Posted 11-Oct-18 1:09am
Updated 16-Oct-18 20:46pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

See Workbook (POI API Documentation)[^]. Always best to read the documentation first.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I had to downgrade apache poi jar from 4.0 to 3.14 to make it work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.181215.1 | Last Updated 17 Oct 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100