I'm new to iOS and am trying to read the contents of a spreadsheet into an iOS array. The spreadsheet that I'm using is a simple 3 x 2 array of numbers for the first column and text for the second. I've tried reading it in with & without column headers, in .xls, .xlsx, . cdv, .txt (unicode and delimited) but without success. The file is called "funds", and the code I'm using is:
NSData *databuffer;
NSFileHandle * file;
NSString *docDir = NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES)[0];
NSString *fileDir = [docDir stringByAppendingPathComponent:@"funds.xls"];
file = [NSFileHandle fileHandleForReadingAtPath:fileDir];
if (file == nil) NSLog (@"Failed to open file");
[file seekTOOffset: 10];
databuffer = [file readDataOfLength: 5];
[file closeFile];
It finds the directory of the file but gives up at [NSFileHandle fileHandleForReadingAtPath:fileDir]
.
What should I be doing? I need help with confirming what file type I should use as the source, and how to read it into an array.
When this has been solved, I'm likely to need to read in large amount of data, several columns, 4k rows, a mixture of text & non-integer numbers.
Is there a format or method I should be using when the volume of data is getting to that size?