I am using MySQL server. Using mysqldump
import command I have taken backup of my database into backup.sql
file. Now I want to convert this file into MS Excel 2010. Please suggest me an easy way without using any third party tools.
Asked
Active
Viewed 8,557 times
2 Answers
2
I am assuming you want the data from the table in excel format. You will want to export your data in '.csv' format. (comma-seperated-values)
SELECT * INTO OUTFILE 'table.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
FROM table
Basically, it selects everything from the 'table' and outputs it into a 'table.csv' file with a comma between the values. For details see :http://www.mysqltutorial.org/mysql-export-table-to-csv/
You then can open the '.csv' file directly in excel and save it in the 'Excel 2010' format.

eureka
- 509
- 1
- 5
- 9
1
The *.sql file type stores COMMANDS and NOT DATA. So it's immposible to do what you want directly, you need first get your data and only then display it or do other things in Excel.

Natan Kara
- 53
- 9
-
Okay ,can you tell me in which format i would get data other than sql – Sri Jun 04 '15 at 11:15
-
If you really need to do it your way - C# and Command Line MS can do it for you. look here for the 2nd one: http://stackoverflow.com/questions/6737064/execute-sql-script-from-command-line – Natan Kara Jun 04 '15 at 11:24
-
You can import CSV data into Excel. But you need a third party tool to export cvs data from mysql or a special dump using mysql: http://stackoverflow.com/questions/12040816 This csv export can't be re-imported into the mysql database because it will not contain the table structure, keys, foreign keys,... – Dietmar Jun 04 '15 at 11:24
-
if you'll choose do it using C# - there are powerful tools for get and manipulate sql things - but you need to learn about DataTables and more C# Classes first for using it. I recommend it! – Natan Kara Jun 04 '15 at 11:30