一. Java对Excel文件读取,通常用poi包来实现
二.代码如下
public class ExcelUtils {
public static final String OFFICE_EXCEL_XLS = "xls";
public static final String OFFICE_EXCEL_XLSX = "xlsx";/**
* 读取指定Sheet也的内容
* @param filepath filepath 文件全路径
* @param sheetNo sheet序号,从0开始,如果读取全文sheetNo设置null
*/
public static String readExcel(String filepath, Integer sheetNo)
throws EncryptedDocumentException, InvalidFormatException, IOException {
StringBuilder sb = new StringBuilder();
Workbook workbook = getWorkbook(filepath);
if (workbook != null) {
if (sheetNo == null) {