Hi everybody,
there is a way to read the Excel File properties such as "Creation Date" or "Author" or other properties?
Thanks
Marco
Hi everybody,
there is a way to read the Excel File properties such as "Creation Date" or "Author" or other properties?
Thanks
Marco
Hi Marco,
you have to use OPCPackage class if your Excel File has Office Open XML format (.xlsx). Here's some code and I've attached script you can download and use.
var file = Dialogs.getFilePath("","xlsx",null,"Select file",0)[0] var baData = file.getData() var fis = new java.io.ByteArrayInputStream(baData) var xlsxFile = org.apache.poi.openxml4j.opc.OPCPackage.open(fis) var author = xlsxFile.getPackageProperties().getCreatorProperty().getValue() var creationDate = xlsxFile.getPackageProperties().getCreatedProperty().getValue() Dialogs.MsgBox(author+"-"+creationDate)
If you need more file properties you can find them in OPCPackage specifications.
I'm sorry. I forgot to close fileinputstream. Add line
fis.close()
after previous code.