Skip to content

Instantly share code, notes, and snippets.

@vmandic
Created October 25, 2018 20:38
Show Gist options
  • Save vmandic/be8ccdef07c1653f1edcc76b8d64bcdd to your computer and use it in GitHub Desktop.
Save vmandic/be8ccdef07c1653f1edcc76b8d64bcdd to your computer and use it in GitHub Desktop.
meds-processor, p3, s6
static ISheet OpenWorkbookSheetWithNpoi(FileStream stream, HzzoMedsDownloadDto med, HzzoMedsDownloadDto latestMed)
{
ISheet drugListSheet = null;
try
{
if (med.FileName.ToLowerInvariant().EndsWith(".xls"))
{
var hssfWorkbook = new HSSFWorkbook(stream);
drugListSheet = hssfWorkbook.GetSheetAt(0);
}
else
{
var xssfWorkbook = new XSSFWorkbook(stream);
drugListSheet = xssfWorkbook.GetSheetAt(0);
}
}
catch
{
// TODO: log error, awh we will do that l8er
latestMed.Href += " - WORKSHEET COULD NOT BE PARSED";
}
return drugListSheet;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment