These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

How to read excel file data ?

Pallavi_Gondkar
Registered: Oct 2 2008
Posts: 22

Hi,

My requirement is to read excel file data. The file will be uploaded in Adobe form. The code i have written to open browse window and to read file data is as below.

var sFile;
event.target.importDataObject(sFile);

var oFile;
oFile = event.target.getDataObject(sFile);
this.parent.parent.Mass_sub.ZPATH1.rawValue = oFile.path;

// access the FileStream
var pFile = event.target.getDataObjectContents(sFile);
var cFile = util.stringFromStream(pFile, "utf-8");

this.parent.parent.Mass_sub.ZCONTENT.rawValue = cFile;

But this code is working fine only for text files. How can i read excel file data?
Please help.

maxwyss
Registered: Jul 25 2006
Posts: 256
Chances are very small that you will be able to read .xls file data, because it is a closed binary format.

You would have to make something non-binary, which would mean tab-delimited or CSV, or if you want to be fancy, XML. These formats can be read.

It might be possible to also interpret the very newest formats, if you can get the XML form in the clear.

Hope this can help.

Max Wyss.
Pallavi_Gondkar
Registered: Oct 2 2008
Posts: 22
Hey thanks a lot for the reply.

I am trying to upload the CSV file but still I am not getting the contents. The above script is ok or it needs any changes to read the contects of CSV file. Please help me.

Pallavi
Pallavi_Gondkar
Registered: Oct 2 2008
Posts: 22
Hey CSV is working fine. My file was not correct thats why I was getting error.

Thanks a lot.