public List <dynamic> ReadAsDynamic(string file) { var parser = new ExcelDataReaderToIParser(file, new ExcelDataOptions()); using (var csv = new CsvReader(parser)) { return(csv.GetRecords <dynamic>().ToList()); } }
public List <T> ReadWithClass <T, T2>(string file) where T2 : ClassMap <T> { var parser = new ExcelDataReaderToIParser(file, new ExcelDataOptions()); using (var csv = new CsvReader(parser)) { csv.Configuration.RegisterClassMap <T2>(); return(csv.GetRecords <T>().ToList()); } }
public List <dynamic> ReadAsExpandoObject(string file, ExpandoObject expando) { var parser = new ExcelDataReaderToIParser(file, new ExcelDataOptions()); using (var csv = new CsvReader(parser)) { foreach (var property in expando) { Console.WriteLine(property.Key + ": " + property.Value); } return(csv.GetRecords <dynamic>(expando).ToList()); } }