using System.IO;
using ClosedXML.Excel;
namespace Foo.Bar.Baz.Qux
{
public static class ExcelHelper
{
public static void CdsmeNcoaImport(Stream stream)
{
using (ExcelPackage package = new ExcelPackage(stream))
{
foreach (ExcelWorksheet worksheet in package.Workbook.Worksheets)
{
switch (worksheet.ToString().Trim())
{
case "Host Organization":
ExcelCellAddress start = worksheet.Dimension.Start;
ExcelCellAddress end = worksheet.Dimension.End;
for (int row = start.Row; row <= end.Row; row++)
{
for (int col = start.Column; col <= end.Column; col++)
{
string setting = worksheet.Cells[row, col].Text;
This is in contrast to this, and I want to mention that without regard to if it is an IXLWorksheet with ClosedXML.Excel or an ExcelWorksheet of OfficeOpenXml (the EPPlus namespace) the means of getting at the name of a worksheet are the same.
No comments:
Post a Comment