Creating a Cell at specific position in Excel file using Java
Apache POI is an open-source java library to create and manipulate various file formats based on Microsoft Office. Using POI, one should be able to perform create, modify and display/read operations on the following file formats/ it can be used to create a cell in a Given Excel file at a specific position. Apache POI is an API provided by the Apache foundation.
Steps to Create a Cell at a Specific position in a given Excel File
- Create a maven project(Maven is a build automation tool used primarily for Java projects) in eclipse or a Java project with the POI library installed
- Add the following maven dependency in the pom.xml file
- Write java code in javaresource folder
Workbook wb =
Sheet sheet = wb.createSheet(
Row row = sheet.createRow(
Cell cell = row.createCell(
rowIndex = cell.getRowIndex();
columnIndex = cell.getColumnIndex();
"Given cell is created at "
+ rowIndex +
+ columnIndex +
Output: On console
Given cell is created at (1,1)
Output: Inside file named ‘Geeks.xlsx’
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!