Reputation: 1649
I am able to export table's data into CSV file but unable to export these data into excel file. Is here any query to export these data into excel file.
I am using this query to export data as a CSV file.
SELECT *
INTO OUTFILE 'C:/your-directory/your-filename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
FROM tableName
I used this for excel file after change file name like your-filename.xls
but its adding extension .xls but giving data like csv.
Upvotes: 7
Views: 1633
Reputation: 72696
You cannot export your query result set directly in excel with SELECT INTO ... You can export in CSV format that can be easily opened by excel as you already done, but you cannot export directly in excel format.
Upvotes: 1
Reputation: 1942
you can use a converter csv to xls?
php example : http://www.performantsystems.com/CSVtoXLS.html
file parameter base example : http://www.convert-files.com/SII/Convert-XLS/English/WebHelp/command_line_manual/examples__conversion/converting_csv__any_character_delimited__files/rhid_convert_a_csv_to_an_xls_file.htm
Upvotes: 0