Answered by:
How to read an excel file?

Question
-
I want to read data from and Excel file . I am developing an Attendance Sheet and i want to add the data of Students from Excel.
samEE
- Edited by Sameel Nawaz Wednesday, June 4, 2014 5:36 PM
Wednesday, June 4, 2014 5:34 PM
Answers
-
HI SamEE666,
Sorry, currently there is no in-box API for you to communicate with Excel documents.
You have to write your own code or to use some third party tools, to use a WCF is also a good option.
A similar C# post I link here, hopefully can help you: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/4fce4765-2d05-4a2b-8d0a-6219e87f3307/reading-excel-file-using-c-in-winrt-platform
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
- Edited by Jamles HezModerator Thursday, June 5, 2014 1:56 AM
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:49 AM
Thursday, June 5, 2014 1:42 AMModerator -
I'd consider using a simpler format like .csv or a.txt - if you say you support Excel, you'd have to handle reading multiple file formats - .docx, and .doc.
You'll also have to work around things like cell formulas, protection, templates, or other things you may not expect.
At least with a .csv or a .txt - the data is just data.
The benefit is that excel can save to a .txt or .csv, so it isn't hard to get a user to do that.
Darin R.
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:49 AM
Thursday, June 5, 2014 2:38 PM -
That code isn't valid in a Windows Store app. You will need a third party component designed for Windows store apps to read Excel files. As Darin says, it may be much easier to use a simpler format.
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:49 AM
Saturday, June 7, 2014 3:10 AMModerator -
Yes. If you need to use Excel files directly then you'll need to find a 3rd party component which supports Windows Store apps. I believe there are several commercial products which do this, but I cannot make any specific recommendations.
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:48 AM
Saturday, June 7, 2014 7:43 PMModerator
All replies
-
HI SamEE666,
Sorry, currently there is no in-box API for you to communicate with Excel documents.
You have to write your own code or to use some third party tools, to use a WCF is also a good option.
A similar C# post I link here, hopefully can help you: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/4fce4765-2d05-4a2b-8d0a-6219e87f3307/reading-excel-file-using-c-in-winrt-platform
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
- Edited by Jamles HezModerator Thursday, June 5, 2014 1:56 AM
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:49 AM
Thursday, June 5, 2014 1:42 AMModerator -
I'd consider using a simpler format like .csv or a.txt - if you say you support Excel, you'd have to handle reading multiple file formats - .docx, and .doc.
You'll also have to work around things like cell formulas, protection, templates, or other things you may not expect.
At least with a .csv or a .txt - the data is just data.
The benefit is that excel can save to a .txt or .csv, so it isn't hard to get a user to do that.
Darin R.
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:49 AM
Thursday, June 5, 2014 2:38 PM -
I found this code. It runs fine on Browser. Now I want to add data of excel in a Table but I don't know how?
<html> <head> <title>Read from Excel or Access</title> <script language="JavaScript"> function getCount() { var cn = new ActiveXObject("ADODB.Connection"); var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\\Users\\MUHAMMAD\\Desktop\\airline.xls;Persist Security Info=False;Extended Properties=Excel 8.0;" cn.Open(strConn); var rs = new ActiveXObject("ADODB.Recordset"); var SQL = "select * from [Sheet1$]"; rs.Open(SQL, cn); if(rs.bof) { document.write('No records available for this query'); } if(!rs.bof) { rs.MoveFirst() while(!rs.eof) { for(var i=0; i!= rs.fields.count; ++i) { document.write(rs.fields(i).value + ", "); } document.write("<br />"); rs.MoveNext() } } rs.Close(); cn.Close(); } </script> </head> <body> <input type="button" value="Get count" onclick="getCount()"> </body> </html>
samEE
Friday, June 6, 2014 5:17 PM -
That code isn't valid in a Windows Store app. You will need a third party component designed for Windows store apps to read Excel files. As Darin says, it may be much easier to use a simpler format.
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:49 AM
Saturday, June 7, 2014 3:10 AMModerator -
It means I have to first convert data from Excel file into .txt or to .csv then use it in my app
samEE
- Edited by Sameel Nawaz Saturday, June 7, 2014 7:08 AM
Saturday, June 7, 2014 7:08 AM -
Yes. If you need to use Excel files directly then you'll need to find a 3rd party component which supports Windows Store apps. I believe there are several commercial products which do this, but I cannot make any specific recommendations.
- Marked as answer by Jamles HezModerator Friday, June 13, 2014 8:48 AM
Saturday, June 7, 2014 7:43 PMModerator -
I have saved excel file as .txt know I want to enter that data into table e.g. the data in the text file is as
Name Father's Name Roll no.
abc xyz 123
then I want to add an other column Attendance
Name Father's Name Roll no. Attendance
abc xyz 123 P
Then I want to save it as excel file..
samEE
- Edited by Sameel Nawaz Monday, June 30, 2014 11:04 AM
Monday, June 30, 2014 11:02 AM