当我试图从 excel 表中读取和打印所有行值时,没有打印单行值,请检查下面的代码
File src = new File("C:\\Users\\zuzu\\Desktop\\chat.xlsx");
FileInputStream fis = new FileInputStream(src);
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet1= wb.getSheetAt(0);
int rowcount = sheet1.getLastRowNum();
System.out.println("Total row is " +rowcount );
for(int i=0;i<rowcount;i++)
{
String data0 =sheet1.getRow(i).getCell(0).getStringCellValue();
System.out.println("values are "+data0);
}
输出是:
Total row is 61
values are Name
values are ram1
values are ram2
values are ram3
values are ram4
values are ram5
ram 6 未打印