I’ve got a custom table in WordPress and I’d like to be able to export the data in that table as a FILE in CSV (semi-colon seperated) format.
I’ve got the data coming out properly, but how do I then save it as an attachment?
Keep in mind that when using WordPress, headers have already been set… and I really don’t know how to get around that.
I’m not sure exactly HOW you’re doing what you’re TRYING to do …
… but this link gives you a simple, straightforward way to write the data as a .csv file you can do a “save as” from your browser:
http://wordpress.org/support/topic/export-wordpress-db-table-to-excel
For these plugins, they use database to store row & column details. You have to extract the data in MySQL database tables ( those table names are usually named after the plugin’s name ) .
If you are still not sure how to do, you can just copy the table being displayed in page in browser, then paste in Excel. Last, save as CSV or XLS if you like.
you can use this code. just copy and past and you have it 🙂
https://gist.github.com/umairidrees/8952054#file-php-save-db-table-as-csv