Reading an Excel File Plug In

OK, I know this is left of field, but…

Do we know of anyone who has done something where via the App runnig on windows we read an Excel file?  The new Excel Files are built on an OPEN XML format, but just wondered if anyone as done anything like that…

Trying to find a way of “bulk” loading some data for the end user and this was an idea that may have some legs… If the App can read the Excel file…

What sort of bulk loading? Is this data that would come with the app or downloaded?

I’m using SQLlite and it works well the speed of I/O is very good.

I want to allow the app to read in the Excel file and then upload it to my webservice. With the App now runnable on Windows just an option to read in Excel data if they user has any.

Does your app need to parse and understand the data or does it just need to be able to read the file, encode it for safe network transport it to a server where the server will parse and understand the data?

These have radically different answers.

Rob

Yep, I would say the latter only Rob. I suppose that is just a HTTP post then with the headers set to binary? Then the server can process the file?

Reading the file is simple. There are API calls like io.open() which will let you read the file into a variable. Once you have that you can upload the file. More on that in a bit. Lets get the file read first:

local function readFile( filename, directory ) local dir = system.DocumentsDirectory if directory then dir = directory end local path = system.pathForFile( filename, dir ) local contents = "" local file = io.open( path, "rb" ) if file then -- read all contents of file into a string local contents = file:read( "\*a" ) io.close( file ) return contents end print(filename, "file not found") return nil, "File not found" end local myExcelSpreadsheet = readFile( "mydata.xlsx", system.DocumentsDirectory )

Now you have your contents in a variable you can work with.

Sending data to a server is tricky. Your receiving script will have its rules on how it expects the data sent to it. It could be a simple HTTP PUT request with the binary data sent in stream. It could be a multi-part MIME HTML form handler that expects the headers and body of a POST request to be setup in particular method. The script could just be looking for binary data or it could be expecting it to be MIME Base64 encoded. Since I have no clue about your server script you may have to figure this out on your own.

Our network.upload() API will work in the simple case of HTTP PUT requests and binary data sent in the stream. It’s really just a wrapper around network.request(). If you need POST and access to control the headers and such, you will use network.request() instead.

See: https://coronalabs.com/blog/2014/02/25/tutorial-uploading-files-demystified/

Rob

Hi there, I need to create an app for a tablet to read an excel file manipulate the data and update the data back to the excel file.

Can you help me with this?

Thanks in advance por any answer

What sort of bulk loading? Is this data that would come with the app or downloaded?

I’m using SQLlite and it works well the speed of I/O is very good.

I want to allow the app to read in the Excel file and then upload it to my webservice. With the App now runnable on Windows just an option to read in Excel data if they user has any.

Does your app need to parse and understand the data or does it just need to be able to read the file, encode it for safe network transport it to a server where the server will parse and understand the data?

These have radically different answers.

Rob

Yep, I would say the latter only Rob. I suppose that is just a HTTP post then with the headers set to binary? Then the server can process the file?

Reading the file is simple. There are API calls like io.open() which will let you read the file into a variable. Once you have that you can upload the file. More on that in a bit. Lets get the file read first:

local function readFile( filename, directory ) local dir = system.DocumentsDirectory if directory then dir = directory end local path = system.pathForFile( filename, dir ) local contents = "" local file = io.open( path, "rb" ) if file then -- read all contents of file into a string local contents = file:read( "\*a" ) io.close( file ) return contents end print(filename, "file not found") return nil, "File not found" end local myExcelSpreadsheet = readFile( "mydata.xlsx", system.DocumentsDirectory )

Now you have your contents in a variable you can work with.

Sending data to a server is tricky. Your receiving script will have its rules on how it expects the data sent to it. It could be a simple HTTP PUT request with the binary data sent in stream. It could be a multi-part MIME HTML form handler that expects the headers and body of a POST request to be setup in particular method. The script could just be looking for binary data or it could be expecting it to be MIME Base64 encoded. Since I have no clue about your server script you may have to figure this out on your own.

Our network.upload() API will work in the simple case of HTTP PUT requests and binary data sent in the stream. It’s really just a wrapper around network.request(). If you need POST and access to control the headers and such, you will use network.request() instead.

See: https://coronalabs.com/blog/2014/02/25/tutorial-uploading-files-demystified/

Rob

Hi there, I need to create an app for a tablet to read an excel file manipulate the data and update the data back to the excel file.

Can you help me with this?

Thanks in advance por any answer