Add an openSheet(index) method

This commit is contained in:
2025-03-18 10:46:09 -05:00
parent 75fdff031a
commit 36ff5eea02

View File

@ -76,6 +76,23 @@ public class XlsxFileToRows extends AbstractIteratorBasedFileToRows<org.dhatim.f
} }
/***************************************************************************
** open/go-to a specific sheet (by 0-based index). resets rows & iterator.
***************************************************************************/
public void openSheet(int index) throws IOException
{
Optional<Sheet> sheet = workbook.getSheet(index);
if(sheet.isEmpty())
{
throw (new IOException("No sheet found for index: " + index));
}
rows = sheet.get().openStream();
setIterator(rows.iterator());
}
/*************************************************************************** /***************************************************************************
** **