No exmplo apresentado abaixo tenho uma classe em java que vai buscar os dados de determinado ficheiro excel. Toda esta parte de ir buscar o ficheiro o programa faz, mas precisava agora que esses dados fossem guardados em uma matriz. Não sei de que forma fazê-lo.
public class UniFederal {
public static void main(String[] args) throws IOException{
List<List<String>> vecSample = new ArrayList<List<String>>();
double[] vect;
int [][]matriz = new int[30][30];
String[][] referencia = new String[][];
File excel = new File("gestaoAlunos.xlsx");
FileInputStream fich = new FileInputStream(excel);
XSSFWorkbook workbook = new XSSFWorkbook(fich);
XSSFSheet sheet = workbook.getSheetAt(0);
Iterator<Row> rowIt = sheet.iterator();
while(rowIt.hasNext()){
Row row = rowIt.next();
int i=0, j=0;
Iterator<Cell> cellIterator = row.cellIterator();
while(cellIterator.hasNext()){
Cell cell = cellIterator.next();
System.out.print(cell.toString() + ";");
//System.out.print(vecSample.get(i));
i++;
}
System.out.println();
}
workbook.close();
fich.close();
}
}