How to use .jxl excel read write libary in Jenkins?

I see a lot of examples online about how to read/write Excel files from groovy, but I must be missing something. When I try to use this import at the top of my file

import jxl.*
import jxl.write.*

I get this:

unable to resolve class jxl.write.WritableWorkbook

Do I have to download the JXL jar libaries and install them somewhere? Or are they part of Jenkins/groovy already? I can’t find any examples online that talk about where to put this file, so it seems like it is already included…? Anybody know why I get this error?

Thanks!

I would recommend against having your pipeline do any complicated processing like that. Pipeline code gets run on the controller and then directs your agents to do things.

If you want to stick with groovy, I would recommend writing a standalone groovy script, with @Grab annotations, that jenkins can call out to.

That being said, I think you can use @Grab in shared libraries as well.

Thanks for the reply.

This is in a shared library groovy file. I am just wondering why I get the “unable to resolved class” error. I am not familiar with @Grab, would it help with that error?