Creating a Cell at specific position in Excel file using Java Last Updated : 30 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 installedAdd the following maven dependency in the pom.xml fileWrite java code in javaresource folder Example Java // Java Program to Demonstrate Creation Of Cell // At Specific Position in Excel File // Importing required classes import java.io.*; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; // Class // CreateCellAtSpecificPosition public class GFG { // Main driver method public static void main(String[] args) throws FileNotFoundException, IOException { // Creating a workbook instances Workbook wb = new HSSFWorkbook(); // Creating output file OutputStream os = new FileOutputStream("Geeks.xlsx"); // Creating a sheet using predefined class // provided by Apache POI Sheet sheet = wb.createSheet("Company Preparation"); // Creating a row at specific position // using predefined class provided by Apache POI // Specific row number Row row = sheet.createRow(1); // Specific cell number Cell cell = row.createCell(1); // putting value at specific position cell.setCellValue("Geeks"); // Finding index value of row and column of given // cell int rowIndex = cell.getRowIndex(); int columnIndex = cell.getColumnIndex(); // Writing the content to Workbook wb.write(os); // Printing the row and column index of cell created System.out.println("Given cell is created at " + "(" + rowIndex + "," + columnIndex + ")"); } } Output: On console Given cell is created at (1,1) Output: Inside file named 'Geeks.xlsx' Comment More infoAdvertise with us Next Article Creating Sheets in Excel File in Java using Apache POI S Shahnawaz_Ali Follow Improve Article Tags : Misc Java Practice Tags : JavaMisc Similar Reads Creating Sheets in Excel File in Java using Apache POI 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. For Example, java doesnât provide built-in support for working with ex 3 min read How to Create Formula Cell in Excel Sheet using Java and Apache POI? In the previous article, we have seen how to read data from the formula cell, here we are going to create the formula cell using Apache POI. Â In this article, we are creating an Excel file with three columns consisting of values and the last column is the formula cell which is calculated from the o 2 min read Reading and Writing Data to Excel File in Java using Apache POI In Java, reading an Excel file is not similar to reading a Word file because of cells in an Excel file. JDK does not provide a direct API to read data from Excel files for which we have to toggle to a third-party library that is Apache POI. Apache POI is an open-source java library designed for read 5 min read How to Create a Formula in Excel using Java? Apache POI is a popular open-source Java library that provides programmers with APIs for creating, modifying, and editing MS Office files. Excel is very excellent at calculating formulas. And perhaps most Excel documents have formulas embedded. Therefore, itâs trivial that on a fine day, you have to 3 min read How to Fill Background Color of Cells in Excel using Java and Apache POI? 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. For Example, Java doesnât provide built-in support for working with ex 3 min read How to Create Pivot Chart from Pivot Table in Excel using Java? A Pivot Chart is used to analyze data of a table with very little effort (and no formulas) and it gives you the big picture of your raw data. It allows you to analyze data using various types of graphs and layouts. It is considered to be the best chart during a business presentation that involves hu 4 min read Like