You need to sign in to do that
Don't have an account?
kutts18
Read User Uploaded Excel File
I have a requirement where through VF page, user will upload an Excel file.
Controller has to read this excel file and display the values in the same page.
Now my question would be
1. Is it possible to read the excel content in controller class?
2. If it is possible, can you explain me with some sample code?
I have a good news for all of you guys,
If you are in desparate need of reading excel,
then you have two options
1. Use Excel Connector (avialable in SFA tools)
2. Use ActiveX in VF page.
I have used the second option, and below is my code...
For more reference
http://www.activexperts.com/activmonitor/windowsmanagement/scripts/msoffice/excel/
Remember that the ActiveX will be unsigned, so user
will prompted wether to execute this ActiveX or not.
But hey you can get the job done in client side itself
cause there is no way you can do it in server side.
Also only IE will support ActiveX, no other browser.
All Answers
I have gone through other community posts and lots of documents
and i have derived the conclusion that
Its impossible to read data from an user uploaded excel file using the current
version of Apex.
Would it be wrong if i conclude like this?
That is correct - there are 3rd party libraries that will read the proprietary Excel binary file format but to date none of them have been wired into Apex Code and there are no plans to do so at this time AFAIK.
Have you considered using apex callouts or apex's built in HTTP client (lets you call your own web service/http server using from apex code - something you can definitely do from you controller) and handling the processing in your own server and then processing the results in apex code?
I have a good news for all of you guys,
If you are in desparate need of reading excel,
then you have two options
1. Use Excel Connector (avialable in SFA tools)
2. Use ActiveX in VF page.
I have used the second option, and below is my code...
For more reference
http://www.activexperts.com/activmonitor/windowsmanagement/scripts/msoffice/excel/
Remember that the ActiveX will be unsigned, so user
will prompted wether to execute this ActiveX or not.
But hey you can get the job done in client side itself
cause there is no way you can do it in server side.
Also only IE will support ActiveX, no other browser.
In Internet Explorer. Go to, Tools -> Internet Options
Click on the 'Security' tab
Then seek the following:
'Download unsigned ActiveX controls'
- Set to 'Prompt'
Initialize and script ActiveX controls not marked as safe
- Set to 'Prompt'
Hi All,
I tried to run this VF page but with no luck. I get this error message "ActiveX component can't create object: 'Excel.Application'".
- Set to 'Prompt'
Initialize and script ActiveX controls not marked as safe
Any ideas, please?
Thanks,
Giang
Hi All,
This code is helped me...but my requirement to display the excel one column content in picklist..can any one help me on this?
Not able to use vbscript in visual force page please help
When i do it in HTML page its working please help.
Not able to read excel in visual force page please help i have done as the solution provided
This can be done using Javascript also which is easy to integrate with apex code
we have an excel file with multiple sheets, We have saved it in static resource now we want to read it from static resource and then we want to parse it using apex to store the sheet records in the custom object fields.
I required the solution immediately.
Thanks in advance.