List:General Discussion« Previous MessageNext Message »
From:Jim Lyons Date:January 5 2010 8:25pm
Subject:Re: Exporting the result of a Query into excel
View as plain text  
Doesn't that depend on how often you want to do it?  If it's a one-time
thing or an occasional thing, it's easier to just dump the table into a
tab-delimited file.  If it's something you want to do on a regular basis,
ODBC is a way you might prefer to go.

But it also would require you to have the authority on a given box to set up
an ODBC connection (which might involve downloading software).  You would
also have to do it on every machine you want to load the data on.  A
tab-delimited file can be transferred to any machine, even stored on a
flash-drive and walked somewhere.


On Tue, Jan 5, 2010 at 1:50 PM, Carsten Pedersen <carsten@stripped>wrote:

> Is there any particular reason not to use the MySQL ODBC driver to import
> the data directly into Excel?
>
> / Carsten
>
> Jim Lyons skrev:
>
>  A command to convert the table mytab in database mydb into a tab-delimited
>> file mytab.txt might be:
>>
>> mysql -e'select * from mydb.mytab' -sss  > mytab.txt
>>
>> The -sss is necessary to remove all the formatting stuff that you normally
>> have in the output of a select statement.
>>
>> An alternative, if you have a directory *** that mysql can write to ***:
>>
>> mysqldump --tab="/home/mysql/temp" mydb mytab
>>
>> This will create 2 files in /home/mysql/temp:  mytab.txt and mytab.sql.
>>  The
>> one you'll want is in mytab.txt.
>>
>> Then use what transfer tool you have, ftp, scp, winscp, rsync to transfer
>> the file to another server.
>>
>> On Tue, Jan 5, 2010 at 7:31 AM, ishaq gbola <ishaqgbo@stripped> wrote:
>>
>>  Thanks a lot for that, but where does this file get saved in and how can
>>> i
>>> copy it to my local host if the database is on a remote server
>>>
>>> --- On Tue, 5/1/10, Jay Ess <lists@stripped> wrote:
>>>
>>> From: Jay Ess <lists@stripped>
>>> Subject: Re: Exporting the result of a Query into excel
>>> To: "mysql@stripped >> Mysql" <mysql@stripped>
>>> Date: Tuesday, 5 January, 2010, 13:22
>>>
>>> ishaq gbola wrote:
>>>
>>>> Hi all,
>>>>
>>>> I would like to know if there is a tool or command in mySQL that allows
>>>>
>>> one to export the result of query into excel formart
>>> select * from table into outfile "thefile.txt";
>>> That can be imported into excel using CSV and using "TAB" as separator.
>>>
>>> http://code.anjanesh.net/2007/12/export-mysql-data-to-excel-compatible.html
>>>
>>> --
>>> MySQL General Mailing List
>>> For list archives: http://lists.mysql.com/mysql
>>> To unsubscribe:
>>> http://lists.mysql.com/mysql?unsub=1
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>


-- 
Jim Lyons
Web developer / Database administrator
http://www.weblyons.com

Thread
Exporting the result of a Query into excelishaq gbola5 Jan
  • Re: Exporting the result of a Query into excelJay Ess5 Jan
    • Re: Exporting the result of a Query into excelishaq gbola5 Jan
      • Re: Exporting the result of a Query into excelJay Ess5 Jan
        • Re: Exporting the result of a Query into excelishaq gbola5 Jan
          • Re: Exporting the result of a Query into excelsureshkumarilu5 Jan
      • Re: Exporting the result of a Query into excelsureshkumarilu5 Jan
      • Re: Exporting the result of a Query into excelJim Lyons5 Jan
        • Re: Exporting the result of a Query into excelCarsten Pedersen5 Jan
          • Re: Exporting the result of a Query into excelLawrence Sorrillo5 Jan
          • Re: Exporting the result of a Query into excelJim Lyons5 Jan
  • Re: Exporting the result of a Query into excelJim Lyons5 Jan
  • RE: Exporting the result of a Query into excelJason Trebilcock6 Jan
Re: Exporting the result of a Query into excelishaq gbola5 Jan
  • Re: Exporting the result of a Query into excelsureshkumarilu5 Jan
  • Re: Exporting the result of a Query into excelMichael Dykman5 Jan