Excel data read

package webapp;

import java.io.FileInputStream;
import java.io.IOException;

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;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class XLSXRead {
public static void main(String[] args) throws IOException {

FileInputStream fis;
Workbook fis_workbook;
Sheet fis_worksheet0;

Cell fis_cell;
String fis_cellValue;

fis_workbook = new XSSFWorkbook(“C:\\Users\\Youtility\\Desktop\\Student.xlsx”);

fis_worksheet0 = fis_workbook.getSheetAt(0);
int sheet0_rowCount = fis_worksheet0.getLastRowNum();
int sheet0_columnCount = fis_worksheet0.getRow(0).getLastCellNum();

fis_cell = fis_worksheet0.getRow(0).getCell(0);
fis_cellValue = fis_cell.toString();

System.out.println(“>>>>>>>>>>>>>>>> cell Text : “+fis_cellValue);
System.out.println(“>>>>>>>>>>>>>>>> sheet0_rowCount : “+sheet0_rowCount);
System.out.println(“>>>>>>>>>>>>>>>> sheet0_columnCount : “+sheet0_columnCount);

}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s