I'm trying to read a .xlsx file using Apache Poi on Eclipse and store the data into an ArrayList.
My code :
import org.apache.poi.ss.usermodel.*; import java.io.*; import java.util.*; public class parseReadFiles { public static void main(String[] args) { try { ArrayList<String> firstList=new ArrayList<>(); //ArrayList<String> secondList=new ArrayList<>(); //ArrayList<String> thirdList=new ArrayList<>(); Workbook wb = WorkbookFactory.create(new FileInputStream("Users/Divjot/Desktop/first.xlsx")); Sheet sheet = wb.getSheetAt(0); ... } catch(FileNotFoundException e) { e.printStackTrace(); } catch(Exception e) { } } }
I keep getting a FileNotFoundException: Users/Divjot/Desktop/first.xlsx (No such file or directory). I've tried different combinations of file names and paths but can't get the program to find it. Should the file be stored in a special place or should the class path be different?