Mail database file as excel from AS400

1.2k Views Asked by At

I am looking for a way to attach a database file as an excel sheet in a mail and send it out from an IBM i server. Please advise if there is any way to do this using only native iseries commands. Our company restricts the use of open source tools available and hence looking for a native method.

I do have the esendmail utility available but it does not have this feature available.

2

There are 2 best solutions below

1
On

I'm on 7.3 and I don't know of an IBM command that will create a spreadsheet. One can create a CSV-like file with CPYTOIMPF, but not a full blown Excel spreadsheet.

You can submit an RFE to ask IBM to provide a native solution, but several similar requests have been turned down because IBM has given us the ability to port / use many existing open source packages. For example, Python 2 and 3 are available from the IBM open source repository via yum, and once Python is on the system, you can pip install any of several Python packages specifically meant to work with Excel.

This hybrid IBM / open source environment is not just the future; it's the present. And IBM is pushing that environment as fast as they can. If my management were to insist that we avoid using the IBM-recommended approach, I'd pretty much be forced to reverse engineer the .XLSX format and write it myself.

If you want to have a taste of what that might look like, take an existing Excel .XLSX file, rename it .ZIP, un-zip it, and poke around inside the folder hierarchy.

1
On

So the real issue I was facing was with how to send the .csv file over email with the correct formatting as I was getting only junk in the attachment while using snddst and esndmail

The SNDSMTPEMM EMAIL command sends the mail with the correct attachment as required.