匹配两个EXCEL表中的数据,即读取一个表中数据在另一个表中查询

时间:2023-01-08 06:12:03
		File file = new File("D://2014BYSSY-6.xls");
		String[][] a1 = ReadExcel.getData(file, 1);
		File file2 = new File("D://校内导入研究生数据.xls");
		String[][] a2 = ReadExcel.getData(file2, 1);

		int flag = 0;
		String temp = "";
		for (int i = 0; i < a2.length; i++) {
			for (int j = 0; j < a1.length; j++) {
				if (a2[i][0].equals(a1[j][3])) {
					temp = a1[j][19];
					flag = 1;
					break;
				} else
					flag = 0;
			}
			if (flag == 1)
				System.out.println(temp);
			else if (flag == 0)
				System.out.println(i + "-----------------");
		}