Category Archives: Java Excel

Java write excel with Apache Poi Java API

Java escribir excel con Apache Poi Java API

In any application or development is often necessary to process Excel files or other spreadsheets, in this case, we will focus on Microsoft’s OLE 2 documents, and manipulate them in this case using Apache POI – the Java API for Microsoft Documents,that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.

We’ll explain how to create a new excel sheet, how to add cells, modify its content and modify its content and definitely manipulate data according to need using the POI-HSSF and POI-XSSF – Java API To Access Microsoft library, where HSSF is the POI project full implementation in Java for excel.

We will introduce the elements of this library that we will use to read and create an Excel spreadsheet.

  • HSSFWorkbook: High level representation of a workbook. This is the first object will construct whether they are reading or writing a workbook.
  • HSSFSheet: high level representation of a worksheet, we can choose the sheet using the HSSFWorkBook.
  • HSSFRow: representation of a row of a spreadsheet, only rows that have cells should be added to a Sheet.
  • HSSFCell: representation of a cell in a row of a spreadsheet, we use to manage the contents of the cell.

Make attention for use this library you need to add it to the project that you are working on, download the library API Apache Poi Java to add it, here I explain how to add it to a Netbeans project, also It can be useful with other IDEs because is do it in a similar way.

 
Continue reading Java write excel with Apache Poi Java API

Java read excel with Apache Poi Java API

Java leer excel con Apache Poi Java API

In any application or development is often necessary to process Excel files or other spreadsheets, in this case, we will focus on Microsoft’s OLE 2 documents, and manipulate them in this case using Apache POI – the Java API for Microsoft Documents,that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.

Performed the introduction, we will introduce the elements of this library that we will use to read and create an Excel spreadsheet.

  • HSSFWorkbook: High level representation of a workbook. This is the first object will construct whether they are reading or writing a workbook.
  • HSSFSheet: high level representation of a worksheet, we can choose the sheet using the HSSFWorkBook.
  • HSSFRow: representation of a row of a spreadsheet, only rows that have cells should be added to a Sheet.
  • HSSFCell: representation of a cell in a row of a spreadsheet, we use to manage the contents of the cell.

Adding de library Apache Poi Java API

After all we need to download the Apache Poi Java API, then we add it to our project, I’m going to explain how to do it in the IDE I’m using for this example: Netbeans, in other IDEs this will be similar.
Continue reading Java read excel with Apache Poi Java API

Netbeans add library Apache Poi Java API

We are going to add the library Apache POI – the Java API for Microsoft Documents, that provides access to different file types Microsoft that use this structure as Excel, Word or Powerpoint, there are other projects in this API to Visio and Publisher for example all these the more developed Excel Workbooks.
 

Netbeans add library Apache Poi Java API

Continue reading Netbeans add library Apache Poi Java API