Introduction
In this article we will learn how to use ZappyShell Command Line Tools for MySQL Excel Export from Table or Query result
The problem
Solution
Download and Install MySQL ODBC Driver
To export data from MySQL we will need ODBC Driver. In this tutorial we have use MySQL ODBC 5.2 Driver but if you are using different driver then change connection string accordingly.
Download and Install MySQL ODBC Driver from below URL
http://dev.mysql.com/downloads/connector/odbc/
Download and Install ZappyShell Command Line Tools
Now next step is we need to Download and Install ZappyShell Command Line tools from hereYou can Download MSI Installer or XCopy Zip file which you can simply extract and copy (see below).

ZappyShell Command Line Tools – Export Excel, Excel, CSV, PDF
MySQL Excel Export – Single table
c:\tools>db.exe export customers --out c:\data\customers.xlsx --excel --overwrite --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"
MySQL Excel Export – Multiple tables
c:\tools>db.exe export customers|orders|products --out c:\data\customers.xlsx --excel --overwrite --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"
MySQL Excel Export – Multiple tables (using pattern)
c:\tools>db.exe export cust% --schema Sales --out c:\data\customers.xlsx --excel --overwrite --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"
MySQL Excel Export – SQL Query
c:\tools>db.exe export "select * from customers where country like 'US%'" --out c:\data\customers.xlsx --excel --overwrite --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"
MySQL Excel Export – Split Files and Tabs
MySQL Excel Export – Split By Row Count
c:\tools>db.exe export customers --out c:\data\cust.xlsx --split --splitrows 1000 --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"
MySQL Excel Export – Split By File Size
c:\tools>db.exe export customers --out c:\data\cust.xlsx --split --splitsize 10MB --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"
MySQL Excel Export – Split By Group By Column
c:\tools>db.exe export customers --out c:\data\cust.xlsx --groupby Country --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"

MySQL Excel Export – Table to Excel, Split files by Country Column
MySQL Excel Export – Split sheets By Group By Column
c:\tools>db.exe export customers --out c:\data\cust.xlsx --groupby Country --excel-split-ontab --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"

ZappyShell – Export MySQL to Excel Split on tabs
Exporting Compressed Excel files
c:\tools>db.exe export customers --out c:\data\cust.xlsx --gzip --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"
Using date time place holders in Excel file name
c:\tools>db.exe export customers --out c:\data\cust_{{YYYY}}_{{MM}}_{{DD}}_{{HH24}}{{MI}}{{SS}}.xlsx --connstr "Driver={MySQL ODBC 5.2 ANSI Driver};Server=your_server_name_or_ip;Port=3306;Uid=user1;pwd=SomeP@ssword;Database=your_db_name"