exporting table structure to Excel files with phpm

2019-04-07 04:21发布

I' going to create an excel file from my table structure in Phpmyadmin(structure only).I found that it has a CSV output but it gives me just data.
Does Phpmyadmin has any feature to do such a thing or not?

Edit: it's my sql :

SELECT * INTO OUTFILE 'c://wamp/my_table_structure.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES  TERMINATED BY '\n'
FROM   INFORMATION_SCHEMA.COLUMNS
WHERE  TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'dt_user'

why it return an empty file?

4条回答
倾城 Initia
2楼-- · 2019-04-07 04:55

You could run a SELECT ... INTO OUTFILE query along the following lines:

SELECT * INTO OUTFILE '/path/to/my_table_structure.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES  TERMINATED BY '\n'
FROM   INFORMATION_SCHEMA.COLUMNS
WHERE  TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'my_table'
查看更多
再贱就再见
3楼-- · 2019-04-07 04:56

You don't need a plugin to copy and paste to Excel.

  1. In phpmyadmin select the table you want to export the schema from
  2. Click on Print View at the bottom of the page
  3. Select the entire (or partial) table and click ctrl-c to copy
  4. Open a new Excel worksheet and select the first cell
  5. Click ctrl-v to paste
查看更多
何必那么认真
4楼-- · 2019-04-07 05:05

I had the same problem and I achieved with the combination of PHPMyadmin and a chrome plugin. This might not be the straightforward way but it just works. (Assuming you are using Google Chrome)

enter image description here

  • once the print view opens in a new tab, click on the plugin icon in the address bar,

enter image description here

  • Click on the plugin icon and you will be shown options to either copy table to clipboard or export to Google docs.

enter image description here

  • I did a copy and pasted the table into excel. You can also export to google docs.

enter image description here

Note: This is just a workaround and just wanted to share this. Please be easy on comments & TD's :) , and I like the way proposed by eggyal anyways!

查看更多
ら.Afraid
5楼-- · 2019-04-07 05:19

Nowadays, phpmyadmin has an export format called CSV for Microsoft Excel, which makes it all automatically, you just need to click export on a table view and choose the format.

查看更多
登录 后发表回答