不在Java中打印excel表中的所有行值

时间:2017-05-10 09:47:09

标签: java excel selenium read-data

当我试图从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未打印

1 个答案:

答案 0 :(得分:-2)

你的陈述中缺少相同的内容:

for(int i=0;i<=rowcount;i++)

   `