0

How do i export mysql table data to microsoft excel?

is there a way to write a query to output this data?

i am assuming the query should take the form

SELECT * FROM Tablename
OUTPUT INTO SOMEFILE.xls;

kindly help

Inventor
  • 485
  • 2
  • 7
  • 13
  • that post doesn't resolve this error ERROR 1 (HY000): Can't create/write to file '/home/inventor/ictbf.csv/' (Errcode: 21) – Inventor Oct 25 '13 at 10:26
  • Then why don't you add to your question that you get this error? *sigh* See e.g. http://stackoverflow.com/questions/7209158/select-into-outfile-not-working-even-for-root http://stackoverflow.com/questions/2783313/how-can-i-get-around-mysql-errcode-13-with-select-into-outfile – Ocaso Protal Oct 25 '13 at 10:27
  • I have managed to accomplish the task SELECT * FROM mytable INTO OUTFILE '/root/tmp/myoutput.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' – Inventor Oct 25 '13 at 12:11

3 Answers3

3

you can do it in CSV format:

SELECT *
FROM Tablename
INTO OUTFILE 'C:/tmp/result.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
Elen
  • 2,345
  • 3
  • 24
  • 47
1

Maybe you can connect to the database using Excel and the just import the data using the specified query.

You can do this on the data tab of Excel. Assuming you have excel 2007 or higher.

0

You can use some GUI clients like SQLyog or Navicat and export. SQLyog has free version.

Sathish D
  • 4,854
  • 31
  • 44