Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a problem when read xlsx to xml

code:
C#
{
             DataSet ds = new DataSet();
            string myXMLfile = @"E:\a.xlsx";
            ds.ReadXml(myXMLfile);
}

message error:
HTML
[ data at the root level is invalid. line 1 position 1.]
Posted
Updated 14-Oct-13 5:02am
v2
Comments
phil.o 14-Oct-13 10:40am    
Did you try to open your xlsx file in a text editor? Does it seem like a regular xml file?
Kenneth Haugland 14-Oct-13 10:48am    
From OP:
my file is xlsx and my file have read my file to xml by use dataset
but when read file message data at the root level is invalid. line 1 position 1.
Kenneth Haugland 14-Oct-13 10:49am    
The *.xlsx file is an excel file or what? IF so you should do something else...

1 solution

Are you sure your reading an XML file?

the xlsx is an Excel 2007 - 2010 file extension
 
Share this answer
 
Comments
Shahin Khorshidnia 28-Sep-17 8:40am    
This so called solution is really a comment. By the way, excel can open some xml files too. So, if you save a proper xml as an 'xlsx' file, it will be opened by excel.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900