Re: Cool MySQL -> Excel Shell Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was playing around with this, and created a DOS batch file that
should be equivalent. Note it was about 15 minutes of work including
debugging, so I can't guarantee success. It's nothing compliated, but
if oyu need to get mysql data into excel often, this might help.

--query.bat--
rem  Show the query
echo Query: %1
rem Run the query (enter as one line, not two!)
mysql --host=localhost --user=<user> --password=password
--database=%2 --execute=%1 > \sql_excel.tmp
rem Open the result in Excel (enter as one line)
start "C:\Program Files\Microsoft Office\Office\EXCEL.EXE"
\sql_excel.tmp
--end query.bat--

Syntax for using it is:

query "<select string>" <database>

You need to use quotes so that DOS understands it's all one command.


--- Michael Zornek <mikezornek@mikezornek.com> wrote:
> Here is a simple, yet very useful shell script that will automate
> MySQL
> output to open into Excel where you can view it with more control,
> save it
> to a spreadsheet for other coworkers, etc.
> 
> I played with this a bit and it's really cool. Bound to save me a
> lot of
> time so I thought I'd share. While this is written mainly for OS X
> I'd
> imagine it could be adapted for Windows if thatıs your OS of
> choice.
> 
> http://www.macosxhints.com/article.php?story=20021125061350898
> 
> ~ Mike
> -- 
> MikeZornek.com
> New blog, new Q&A column, new content everywhere!
> http://www.mikezornek.com
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=====
Mark Weinstock
mark_weinstock@yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***************************************

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux