A few days ago I wrote a small program, read the data in Excel, and chose JXL.JAR at first, but JXL can only read the data of .xls. The data in .xls was relatively small. By 256, the demand for some big data cannot be met, so you need to read the .xlsx file, so I chose to implement it. These jar packages (have been pasted below) need no one.
public class Caculat {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
try {
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(“F:/11.xlsx”));
XSSFSheet sheet = workbook.getSheetAt(0);
int RSROWS = Sheet.getPhysicalNumberofrows (); //
xssfrow hssfrow = sheet.getRow (0); // get a line, and then get the number of columns in the next step
int RSColumns = hssfrow.getphysicalNumberofells (); // column
for (int i = 0; i < rsRows; i++)
{
for (int j = 0; j < rsColumns; j++)
{
xssfcell C1 = Sheet.getRow (i) .getcell (j); // Get the No. j column j of line i
double p = c1.getNumericCellValue();
System.out.print(p+”,”);
}
System.out.println();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
I read the data, so the format is numbers, so the data is not specially processed! There is no problem with the above procedures! Here I have uploaded the bag I used, and you need to download it here! If there is something wrong, please coach!