how to write and save on excel

The first creation part is same then go to a cell where you want to write.

Row row = sheet.getRow(0)
Cell cell = row.getCell(2)

Let's imagine you have values in index 0 and index 1.
Now you want to create a cell on index 2. First, check if it is null to 
avoid problems.

if(cell==null){
   cell = row.createCell(2);
}
cell.setValue("Germany");

in order to save:
FileOutputStream fileOutputStream = 
           new FileOutputStream("src/test/resources/Countries.xlsx");

workbook.write(fileOutputStream); ==> write the changes to the file and save

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source