java通过poi方式读取excel文件
适用于.xlsx格式,如果是xls可以先将xls转换成xlsximport org.apache.poi.ss.usermodel.Cell;import org.apache.poi.ss.usermodel.Row;import org.apache.poi.xssf.usermodel.XSSFSheet;import org.apache.poi.xssf.usermodel.XSSFWorkbook;String filePath = "C:\\Users\\1606020155.xlsx";InputStream is = new FileInputStream(filePath);XSSFWorkbook wb = new XSSFWorkbook(is);XSSFSheet sheet = wb.getSheetAt(0);Row row=sheet.getRow(2);Cell cell=row.getCell(3);System.out.println(cell.getDateCellValue());
遍历excel的数据
for(int i=0;i<sheet.getLastRowNum();i++){ Row row=sheet.getRow(i); System.out.println(row.getCell(0).getDateCellValue()); }