This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DataTable ReadExcelSheet(string fname, bool firstRowIsHeader) | |
{ | |
List<string> Headers = new List<string>(); | |
DataTable dt = new DataTable(); | |
using (SpreadsheetDocument doc = SpreadsheetDocument.Open(fname, false)) | |
{ | |
//Read the first Sheets | |
Sheet sheet = doc.WorkbookPart.Workbook.Sheets.GetFirstChild<Sheet>(); | |
Worksheet worksheet = (doc.WorkbookPart.GetPartById(sheet.Id.Value) as WorksheetPart).Worksheet; | |
IEnumerable<Row> rows = worksheet.GetFirstChild<SheetData>().Descendants<Row>(); |