PDA

View Full Version : Load data to store from Excel File



testowy
6 Nov 2012, 3:14 AM
Hi,
I use Google Drive SDK to download excel file from GoogleDoc. Now, I would like to show this data use ExtJS component like Grid. Is possible to do that? Thx for anserws.

tvanzoelen
6 Nov 2012, 4:19 AM
You could pass the data of the googe drive into an array an read it with the ArrayReader to display it in a grid.

Here an example of a basis ArrayGrid

http://docs.sencha.com/ext-js/4-1/#!/example/grid/array-grid.html

testowy
7 Nov 2012, 12:16 AM
I think of this solution, but I don't have idea how can i pass this data from google drive. I can only download this file like odt,xls or pdf. So how can i export it to array?

tvanzoelen
7 Nov 2012, 12:24 AM
Well you must manipulate the file with javascript. I don't know how google SDK returns it. But you must find a way to access it.

If the SDK has a SOAP protocol or it returns XML there are readers for it. So make an Ajax call lto the SDK read the response, transform the data and put it in a store for display in a grid.

testowy
7 Nov 2012, 12:33 AM
I download Google Doc file in my application. Google SDK support this MIME Type for google doc file:
https://developers.google.com/drive/manage-downloads

In my case support MIME type:


Spreadsheets
MS Excel
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet



Open Office sheet
application/x-vnd.oasis.opendocument.spreadsheet



PDF
application/pdf


I suppose ExtJS not support reader for Excel file? So i need transform this file using other library or pure JS and then load this file to array grid?

tvanzoelen
7 Nov 2012, 12:43 AM
There is no Excel reader. You must write it yourself I think.

testowy
7 Nov 2012, 12:48 AM
Thank you very much for all answers.

tvanzoelen
7 Nov 2012, 12:58 AM
You can google a bit, Excel can be read with ActiveX in javascript.

Something like



var excel=new ActiveXObject("Excel.Application");



but then the client must have this stuff installed

testowy
7 Nov 2012, 2:12 AM
but then the client must have this stuff installed

It's not good solution for me. I found it today.