How to get filename of xlsx file with apache poi XSSF?
case class XlsxSplitter(path: InputStream){
lazy val spreadSheet=load(path)
def load(path: InputStream):SpreadSheet={
val wb = new XSSFWorkbook(path)
.........
}
}
I could extract it from the path, but I would like to make my case class as generic as possible.
If you're able to change the path attribute to a attribute of type File instead of InputStream, you can get the filename from the file itself by file.getName();
Otherwise I think you have no other choice than extracting it by yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With