----------------------------------------------------------------------------- ClientInfo | FieldInfo | RigInfo | ----------------------------------------------------------------------------- Name | abc | Field | f1 | Rig | r1 | ----------------------------------------------------------------------------- Div | d1 | Field | f2 | Rig | r3 | ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- ClientInfo | FieldInfo | RigInfo | ----------------------------------------------------------------------------- Name | abs | Field | f3 | Rig | r2 | ----------------------------------------------------------------------------- Div | d3 | Field | f4 | Rig | r4 | -----------------------------------------------------------------------------
public class ImportFromExcel { public string Client { get; set; } public string Division { get; set; } public string Superintendent { get; set; } public string GS { get; set; } public string Engineer { get; set; } public string Foreman { get; set; } public string Field { get; set; } public string Well { get; set; } public string SITE { get; set; } public string Operations { get; set; } public string Equipment_Name { get; set; } public long Distance { get; set; } public string Last_24_hrs_Operations { get; set; } public string Next_24_hrs_Operations { get; set; } public string Issues { get; set; } public DateTime EquipmentMovement_in { get; set; } public DateTime EquipmentMovement_out { get; set; } public long No_OfHours { get; set; } public string Crew { get; set; } public long TotalNoEmployees { get; set; } }
List<ImportFromExcel> regCandidates = new List<ImportFromExcel> { }; if (fuExcelfile.HasFile) { string csvFilePath = ""; if (fuExcelfile.HasFile) { csvFilePath = "" + @"" + SaveDocument(fuExcelfile); //Excel file path hdnfilepath.Value = csvFilePath; } else { csvFilePath = hdnfilepath.Value.ToString(); } List<string> Fulltext= File.ReadAllLines(csvFilePath).Where(line => !string.IsNullOrWhiteSpace(line)).ToList(); //getting some rubbish data var strText = Fulltext; }
var package = new ExcelPackage(new FileInfo(@"fullFIleName.xlsx")); ExcelWorksheet sheet = package.Workbook.Worksheets[1]; foreach(var tb in sheet.Tables) { //read data from table //ignore headers }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)