用Java技术读取Excel文件中的某列的所有值时间:2023-02-16 19:49:22所需jar包: poi-3.6-20091214.jar 样例文件如下: 现在的目标是要把A,B,C,D,E,F,G这些值取出来,然后打印. public static void main(String[]args){ ArrayList<String> columnList = new ArrayList<String>(); File file = new File("test.xls"); try { FileInputStream in = new FileInputStream(file); HSSFWorkbook wb = new HSSFWorkbook(in); Sheet sheet = wb.getSheetAt(tabIndex); int firstRowNum = sheet.getFirstRowNum(); int lastRowNum = sheet.getLastRowNum(); Row row = null; Cell cell_a = null; Cell cell_b = null; for (int i = firstRowNum; i <= lastRowNum; i++) { row = sheet.getRow(i); //取得第i行 cell_a = row.getCell(0); //取得i行的第一列 String cellValue = cell_a.getStringCellValue().trim(); System.out.println(cellValue); columnList.add(cellValue); } } } catch (Exception e) { e.printStackTrace(); }}