Import feature region data (POI use)

apache POI technology

Apache POI is an Apache Software Foundation open source libraries, POI provides an API to the Java program to read and write Microsoft Office file format functions.

 

Download Development Kit:

The above extract the zip file:

 Introduction rely POI in the project:

<dependency>
	<groupId>org.apache.poi</groupId>
	<artifactId>poi</artifactId>
	<version>3.11</version>
</dependency>

POI use:

@Test
	public void test1() throws FileNotFoundException, IOException{
		String filePath = "D:\\区域导入测试数据.xls";
		//包装一个Excel文件对象
		HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(new File(filePath)));
		//读取文件中第一个Sheet标签页
		HSSFSheet hssfSheet = workbook.getSheetAt(0);
		//遍历标签页中所有的行
		for (Row row : hssfSheet) {
			System.out.println();
			for (Cell cell : row) {
				String value = cell.getStringCellValue();
				System.out.print(value + " ");
			}
		}
	}

 

Released 2417 original articles · won praise 62 · Views 200,000 +

Guess you like

Origin blog.csdn.net/Leon_Jinhai_Sun/article/details/105176665