ARIS Community - We Love BPM

Excel File Properties

Marco Pisani's picture
by Marco Pisani in Reports & Macros posted on 2017-10-11

Hi everybody,

there is a way to read the Excel File properties such as "Creation Date" or "Author" or other properties?

 

Thanks

Marco

 

449 Views
0 Likes
3 Comments
Tags
There are no attachments
Nikita Martyanov posted on 2017-10-11

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.

File attachments: 
Nikita Martyanov posted on 2017-10-12

I'm sorry. I forgot to close fileinputstream. Add line

fis.close()

after previous code.

Robert Goldenbaum posted on 2017-10-16

Nice - thanks for the information...

 

BR Robert