Has anyone used libxlsxwriter to export data to Excel in iOS? I got the library up and running. Given below is the code that I have tried.
lxw_workbook *workbook = new_workbook("demo.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
int ret = worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
ret = worksheet_write_number(worksheet, 1, 0, 123, NULL);
int ret1 = workbook_close(workbook);
if(LXW_CLOSE_ERROR_ZIP == ret1)
NSLog(@"Failed");
It is consistently failing for me at workbook_close();
This is the error message I am getting
[ERROR][/path/packager.c:62]: Error opening zip file for xlsx
[ERROR][/path/workbook.c:1108]: Memory allocation failed.
Any idea why this is happening? Is there any other library that I can use?
Those errors are misleading. They are usually generated when the output file or directory isn't writeable.
For example:
I'll see if I can add a fix to the library to make the actual source of the error clearer.
Update: In newer versions the error is clearer: