Hi Guys,
I am using the Add-On Adaptavist ScriptRunner for JIRA Standard Edition.
In my Script I need to read an Excel (xlsx)-File, but it continuously fails.
My Code:
File file = new File(path); if(file.exists()) Sheet mySheet = WorkbookFactory.create(new FileInputStream(file)).getSheetAt(0);
I am using the following jars:
dom4j.jar xmlbeans-5.2.4.jar
If I use these jars:
poi-3.9.jar poi-ooxml-3.9.jar poi-ooxml-shemas-3.9.jar
I Get an this error:
org.apache.poi.openxml4j.exceptions.InvalidFormatException: Can't read content types part !
If I use these jars:
poi-3.11.jar poi-ooxml-3.11.jar poi-ooxml-shemas-3.11.jar
I Get an this error:
java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller
although this class is in poi-ooxml-shemas-3.11.jar.
I also tried mixing them:
The error always depends on the poi-ooxml-shemas-x.x.jar
Does anyone know how to handle this? Thanks for your help.
PS: I have no problems opening the xlsx-File with Excel
Community moderators have prevented the ability to post new answers.
Hi Moritz,
I am not familiar with the third party Jar's that you are using so cannot comment on why they do not work.
I have found an example located at https://gist.github.com/jkeam/4083570 which shows how you can read in an excel file in Groovy and I have been able to get this working in the Script Console of my JIRA 6.4.12 instance by pulling in the required using Grapes by adding in the code below at the top of the script.
@Grapes([ @Grab(group='org.apache.poi', module='poi', version='3.8'), @Grab(group='org.apache.poi', module='poi-ooxml', version='3.8') ])
I hope this helps you to resolve your issue.
Thanks
Kristian
Kristian, I am trying to implement this also, I have looked at the link but when I put your grapes code at the to of my script in the script console I get
startup failed:
Script21.groovy: 4: unexpected token: @ line 4, column 3.
])
^
1 error
Is there something I have to do to get grapes working with jira? I am using jira 7.12.3, scriptrunner 5.4.39
Thanks
I also tried ( 4.0 and several other versions )
groovy.grape.Grape.grab(group:'org.apache.poi', module:'poi', version:'4.0')
groovy.grape.Grape.grab(group:'org.apache.poi', module:'poi-ooxml', version:'4.0')
Error grabbing Grapes -- [unresolved dependency: org.apache.poi#poi;4.0: not found]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you make sure all of the 3rd party jars are owned by the jira user running the application?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.