[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 973
  • Last Modified:

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.
0
prosperion
Asked:
prosperion
2 Solutions
 
armoghanCommented:
Hi prosperion,
Why dont you save it as a file somewhere and then read it from there. Something like this
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20725878.html

and then you may add it in DataSet
http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20899600.html
Cheers!
0
 
edj371Commented:
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.

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

Thanks,
Tym.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now