Extract excel attachment from email

I want to get the excel attachment from a email and use apachi POI to extract the content from it. Anyone have any idea how to do?

Andy

I’ve used POI to do just the opposite, i.e., grab data from an IS document to create a new Excel spreadsheet and attach it to an email.

Going in the opposite direction should not be much different.

Once you have the attachment as a stream, pass it to your Java service that does the POI work. Since this is more of a Java programming exercise, I found it helpful to develop the logic in an external IDE (I use NetBeans).

There is lots of info you can google to get you started.
For example:
http://www.javaworld.com/javaworld/jw-03-2004/jw-0322-poi.html

Regards.

I’ve done the extract from Excel to create an IS document using POI with little trouble. Just make sure you have the necessary libraries available to IS when it starts up. I used the event API of POI which seemed to work fairly well at conserving memory. I too did what Mark did and used an external IDE (VisualAge for Java in my case) to do the majority of the development/debugging and then put the result into IS.

Hey Rob - just a quick off-topic comment on your choice of IDE:

“used an external IDE (VisualAge for Java in my case)”

Visual Age for Java is (or “was”) superb, isn’t it? Which version do you use? VAJ had tons of really neat features eg: built-in source repository with the ability to version down to the method level.

Now of course, Websphere Studio has replaced VAJ ( http://www-106.ibm.com/developerworks/websphere/zones/vajava/
) and Eclipse is it’s freely available version, but last I checked, many of the old VAJ features did not exist in Eclipse.

Any idea how can I change the excel attachment into a stream?

VAJ took a bit of getting used to at first but it had some really neat aspects. Setting up to use external libs (e.g. the ActiveWorks/webMethods jars/classes) was a pain but once set up made development nice and easy. I liked that it would compile immediately on save so you never had to remember to come back to something to finish it up.

IIRC I used version 2.1 but my memory may be faulty. Everything seems to carry the WebSphere brand name now. WebSphere CICS anyone? :wink:

Thanks Rob. Perhaps you’re using websphere, not VAJ? I recall using VAJ 3.0 or 3.5 back in 1998-99 - a free copy from a programming contest in grad school. It was easy to grasp, and the facilities were l33t for it’s day: compile-on-save, the ‘problems’ tab, scratchpad, CTRL+W code formatting, thread debugger… nice memories.

Sorry Andy I’ll keep quiet now and let the thread continue with Apache POI. Just in case you haven’t looked, you’ve seen the shareware entries that on Excel and POI, right? See top two entries here:

http://www.wmusers.com/shared/browse.shtml

Reamon,

Could you please attached a sample of the java service on how you accomplish this? Much appreciated it.

Alas, I cannot. It was work done under a contract and is not mine to share. :frowning:

I’ll figure it out. It’s not like rocket scientist.