Zen Cart Logo
Forums / General Questions / Email Query Results as XLS or CSV

Email Query Results as XLS or CSV

Locked

Views: 1,881

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
5 Aug 2009, 3:22 AM
#1
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Email Query Results as XLS or CSV

I want to put a button on any admin page that runs a query and emails the result as an attachment. All I can find are suggestions to export, then attach them manually.

Since at least 2007 there are many people here who want to email order information to suppliers, and most suggest they prefer XLS, but CSV would work. Unfortunately, it appears no one has ever created that solution.

I know how to write SQL, but I don't know how to email the query results. Oddly, ZenCart supports email (it sends order confirmations), and PHPmyAdmin can export an XLS file.

Can anyone help? Again, just looking to run any query (select * from zen_customers) and automatically send the results to a fixed email address (joe AT zenisfun DOT com) as an attachment (preferably XLS).

Thanks

10 Aug 2009, 7:58 PM
#2
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Re: Email Query Results as XLS or CSV

Maybe instead someone knows how to email anything as a CSV, PDF, whatever attachment?

Again, extracting the data isn't the problem. I even know how to put query results into the body of an email. I just need to send an attachment for formatting reasons.

10 Aug 2009, 8:03 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Email Query Results as XLS or CSV

Using a program to type in an SQL query or even build one interactively, and then run it, is one thing.
Having that program output it to a CSV or XLS or other file is yet another.
And then attaching that file to an email is ... well ... another step you would do after that, on your own.

But you're not asking for that.

You're asking for something to automatically, without your interaction at all, determine which data to extract, dump that content to a file, and then generate an email with that file in it.

It can certainly be done. But I suggest you offer to open your checkbook for whomever might consider writing such a tool for you. It's not a trivial task.