public static InternalSpreadsheet ReadFromFile(string path, IWebSocketProgress progress = null) { progress = progress ?? new NullWebSocketProgress(); var result = new InternalSpreadsheet(false); try { SpreadsheetIO.ReadSpreadsheet(result, path); } catch (InvalidDataException e) { Bloom.Utils.MiscUtils.SuppressUnusedExceptionVarWarning(e); progress.MessageWithoutLocalizing( "The input does not appear to be a valid Excel spreadsheet. Import failed.", ProgressKind.Error); return(null); } catch (SpreadsheetException se) { progress.MessageWithoutLocalizing(se.Message, ProgressKind.Error); return(null); } catch (Exception e) { progress.MessageWithoutLocalizing("Something went wrong reading the input file. Import failed. " + e.Message, ProgressKind.Error); return(null); } return(result); }
public static InternalSpreadsheet ReadFromFile(string path) { var result = new InternalSpreadsheet(); SpreadsheetIO.ReadSpreadsheet(result, path); return(result); }