Question

I'm using the NPOI Library to import some data from an excel sheet to my database.

One early issue I'm curious about, is typically, to begin, you would have something like this:

snippet

 using (FileStream fs = File.Open(filename, FileMode.Open, FileAccess.Read))
                {
                    HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs);
                    HSSFSheet sheet = templateWorkbook.GetSheet("Sales");

My query is, what happens when the name of the worksheet is different each time, e.g. I plan to import sales data, and the sheets within the workbooks I receive from suppliers are titled by date.

Is there any way that you can specify GetSheet(); to just get the first sheet in the workbook?

Any pointers would be much appreciated,

thanks guys :)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top