0

I want to read multiple files and store them into a database. Here's my code that reads only one file. How can I make it read more than one?

private static final String FILE_NAME = "C:/User/myFile.xlsx";

public static void main(String[] args) throws SQLException {

    try { 

        FileInputStream excelFile = new FileInputStream(new File(FILE_NAME));
        Workbook workbook = new XSSFWorkbook(excelFile);

        Sheet datatypeSheet = workbook.getSheetAt(0);
        Iterator<Row> iterator = datatypeSheet.iterator();
 }
}
jyxxy
  • 13
  • 4
  • 3
    All you need is an array of file paths and a loop! – user2004685 Feb 24 '18 at 00:58
  • 1
    So you have two tasks: 1) Get a list of the files in the folder and put them into an array, and 2) loop through that array to get each filename to process. Start by searching here to find code to do the first task (it exists), and once you get working then start on the second task. Put them together, and you're done. Good luck. – Ken White Feb 24 '18 at 01:09

0 Answers0