如何使用Java比较数据存档和数据列Excel?

时间:2019-06-29 03:11:34

标签: java excel

package mtfn;

import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.NumberCell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import javax.swing.JOptionPane;

public class lerexcel {

    public static void main(String[] args) throws IOException, BiffException {

        Workbook workbook = Workbook.getWorkbook(new File("data/aeiouadoipa.xls"));
        Sheet sheet = workbook.getSheet(0);        

        int linhas = sheet.getRows();
        System.out.println("Iniciando a leitura da planilha XLS:");
        for(int i = 0; i<linhas; i++){
            Cell a1 = sheet.getCell(0,i);

            String as1 = a1.getContents();

            System.out.println("Coluna 1: " + as1);     

        }               
    }

    public static void verifica(String as1){

       String words= "Mirra" ;

       while (words!=null){

          String fileWord= words;

          if (fileWord.equals(as1)){ 
               System.out.println("ok");
          }
       }
    }
}

0 个答案:

没有答案