/// <summary> /// import file excel file to a IEnumerable of TModel /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="path">excel full path</param> /// <returns></returns> public static IEnumerable <TModel> ExcelToObject <TModel>(string path) where TModel : class, new() { var importer = new ExcelImporter(); return(importer.ExcelToObject <TModel>(path)); }
/// <summary> /// convert a excel file(bytes) to IEnumerable of TModel /// </summary> /// <typeparam name="TModel"></typeparam> /// <param name="bytes">the excel file bytes</param> /// <returns></returns> public static IEnumerable <TModel> ExcelToObject <TModel>(byte[] bytes) where TModel : class, new() { var importer = new ExcelImporter(); return(importer.ExcelToObject <TModel>(bytes)); }