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

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.