C# - Reading Excel files.

I have question on how to dealing with reading an Excel file and I really need some help. I created an ASP.NET page where user can upload an Excel file. (I used <INPUT type=FILE> ) After the user submit, I got the PostedFile.InputStream and stored it as binary array. The question is how would I convert that binary array into Excel object or put it into a DataGrid or DataSet where I could loop through and do my calculation.

I don't have the option of writing that buffer to the Server where I can re-open with the Excel object.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi prosperion,
Why dont you save it as a file somewhere and then read it from there. Something like this

and then you may add it in DataSet

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Have you decided on an approach yet, prosperion?  It sounds like you do not have the option of saving the xls file to the server, is that correct?

How much processing are you doing on this excel file?  Do you care about any VBA, or are you merely taking cell contents (formulas and formatting)?  What kind of browsers are you expecting to support?  Could you use any ActiveX controls, client-side?  An ActiveX control could convert your xls file content to xml (assuming you are excluding VBA for the time being, but that may be able to be handled as well) where you could input that stream into your object model for your calculations or processing.  The use of the ActiveX control, in order to limit the size of the control, would (reasonably) assume the client had the Excel API of one version or another.  There would be some messy parts involved, but all within reason.

prosperionAuthor Commented:
We have actually figured this out, and decided to just save the file - and it seems to be working fine.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.