I have a set of excel templates, which will be entered by users. I have to import the data entered in to this templates to database. Problem with the templates is that they are not in the tabular formats.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From your question, I gather you’ve already ruled out using JET/OLEDB to access the spreadsheet data, which only really works with tabular data. So, you’re going to need some way of accessing individual cells, etc.
You could open the Excel files using Excel (via interop), as I’m sure someone will suggest. But, if you can avoid doing this, you should – there are all sorts of problems with it (it’s flaky, and you’ll get no help from Microsoft since they basically say don’t do it).
You can avoid having to do this if you can have your Excel files saved as XML.
If you’re using Excel 2003 then you can Save As “Xml Spreadsheet”, which is
functionally equivalent to a normal
XLS file, except that it cannot
contain charts or macro code. Other
than that, it looks exactly the same
to a user – and it’s much easier to
process in code.
If you’re using Excel 2007 then the
native file format is already XML
(albeit stored within a ZIP file),
and again you can process that in
code. There are lots of examples on-line.