0

I am using OpenXml for reading excel file into DataTable from c#.net. Its going all well for xlsx file but it is giving me exception as "File Contains corrupted Data" when trying to read xls file.

Is there any way to read xls file using OpenXml from c#.net application????

Please help.

Thanks.

swarraj
  • 25
  • 2
  • 9
  • It is impossible to use Open XML. Take a look this site [Not able to read .xls (Excel file 2003 -2007) using openxml](https://social.msdn.microsoft.com/Forums/en-US/021cd53b-167f-4415-9764-90507e742e5d/not-able-to-read-xls-excel-file-2003-2007-using-openxml?forum=oxmlsdk) – 劉鎮瑲 Jan 21 '19 at 01:11

2 Answers2

2

No, there is no way at all to read XLS files using OpenXML. XLS is the old Excel file format that was the standard until and including Word 2003. It uses XML inside, but not the Office Open XML format used in XLSX files.

bstenzel
  • 1,231
  • 9
  • 14
0

Try saving the file in another format, Excel Workbook (xlsx) worked for me when getting the same error.

Mårten Thurén
  • 149
  • 1
  • 13