How to import data from MySQL db into excel sheet
John Nagle
nagle at animats.com
Thu Jun 30 14:00:15 EDT 2011
On 6/2/2011 5:11 AM, hisan wrote:
> Please let me know how can i import my sql data of multiple rows and
> columns into an excel sheet.
> here i need to adjust the column width based on the on the data that
> sits into the column
You're asking in the wrong forum. Try the MySQL forum or an
Excel forum.
For a one-off job, use the MySQL Workbench, do a SELECT, click on
the floppy disk icon, and export a CSV (comma-separated value) file,
which Excel will import.
It's possible to link Excel directly to an SQL database; see
the Excel documentation.
On a server, you can SELECT ... INTO OUTFILE and get a CSV file
that way, but the file is created on the machine where the database
is running, not the client machine.
You can write a Python program to SELECT from the database and
use the CSV module to create a CSV file, but as a one-off, it's
not necessary.
John Nagle
More information about the Python-list
mailing list