I have a program that I want to send some data to an excel sheet using the jxl library. I'm following a tutorial and have the following code snippet that I believe should create an .xls file with a Sheet and some data. However I'm getting a file not found error with whatever path I give. If I enter no path there is a write-only system error although I have read/write internal/external permissions in my manifest. If someone could point out the error I would appreciate it as I'm still somewhat new to java/android.
try {
String exlFile = "Workbook1.xls";
WritableWorkbook writableWorkbook = Workbook.createWorkbook(new File("/Users/xxxxxx/Documents/", exlFile));
WritableSheet writableSheet = writableWorkbook.createSheet("Sheet1test", 0);
//Create Cells with contents of different data types.
//Also specify the Cell coordinates in the constructor
Label label = new Label(0, 0, "Label (String)");
DateTime date = new DateTime(1, 0, new Date());
//Add the created Cells to the sheet
writableSheet.addCell(label);
writableSheet.addCell(date);
//Write and close the workbook
writableWorkbook.write();
writableWorkbook.close();
} catch (IOException e) {
e.printStackTrace();
} catch (RowsExceededException e) {
e.printStackTrace();
} catch (WriteException e) {
e.printStackTrace();
}
Error:
java.io.FileNotFoundException: /Users/xxxxxx/Documents/Workbook1.xls (No such file or directory)