How to read a xlsx file

Hello Everyone,
I have the following question:

Can I read a xlsx file from code-behind? and if I can, how can achieve this? I mean:
An user select the file from its disc and upload it to the server, in the server I don't care about saving the file, I just want to read it and save the values on it. The format in the excel file is as follows:

DATE             |  PERCENTAGE
2009-01-01  |  0,17%
...
2010-01-01  |  100%

some random text
DATE            | PERCENTAGE

I want to read it and save its values into my database.
Im using:
Visual Studio 2008 Developer Edition.
MySql 5 Community Server

In advance, many thanks!
barclowAsked:
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.

Dennis AriesCEO @ Arkro ITCommented:
An XLSX-file is a zipped file containing several xml-files (and possible other data). You can read a specific xml-file from the zipped stream and extract your data from that.
0
Daniel Van Der WerkenIndependent ConsultantCommented:
This is how I'd do this (there may in fact be better and easier ways, but I am not aware of them):

I.  Using Office Interop:
    A.  Install the Office Primary Interop Assemblies for the version of MS Office I have installed on my dev machine and ASP .NET server.  I would assume to have the same version on both.

    B.  Include the Interop for Excel in your project references, add the appropriate using statement.

When the user uploads the file, you will want to load it as an Excel document using the appropriate Excel application object.  This whole interop business is tricky, but you should be able to figure it out if you examine the VBA help files and do some research on the web.  You basically create an application, load the document, and then access the worksheet.

From the worksheet, you can select the range or cell via the column and row.  Grab the value out of this cell, and you have the information you needed.

It's <sarcasm on>that simple</sarcasm off>.

Sorry but that's the only way I would know how to do this.

0

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
rck1988Commented:
Download the microsoft converter.
0
barclowAuthor Commented:
Thanks to everybody, Dan7el I've awarded you with 100 points cause that is a way to do this. But the solution I will implement is the one of mroonal.

Thanks everybody ^^
0
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
.NET Programming

From novice to tech pro — start learning today.