I want to export the database to CSV file and read in MatLab.
I use phpMyAdmin to export to CSV file, but each field is with quotes, so that MatLab cannot correctly read it.
How can I export CSV file without quotes?
update
And how to use SQL command to export?
Depends on what version of phpMyAdmin you're using. In 3.4.9 (the latest release as of today), You'd select Export, Custom - display all possible options radio button, Format CSV, and just erase the Columns enclosed with: field.
This is offtopic, but still: in PHPMyAdmin, if you use 'csv' as export, you can set the "Fields enclosed by" option to from " to nothing, right?
Related
Exporting a recordset to an external csv file generates a csv file which is comma separated in Mysql workbench. Is there a way to make it export to a semicolon separated csv file instead?.
I tried looking if there is some settings in Mysql workbench which can be changed to make the csv as semicolon separated but couldnt find. Is the exported csv file comma separated by default and cannot be changed or is there a workaround?
Yes, you can. When you are exporting the result set, choose "CSV (; separated)" instead of "CSV" as the output format. See the related documentation (and a screenshot).
Alternatively, the table "Table Data Export Wizard" also has an option to use ";" as the field separator. Get there by right-clicking on a table in the schema viewer.
1.run the query for output in Workbench
2.select the following button for export to records
Insert the following values
Click on export. The records would be exported to a csv file mentioned in the "File Path"
When I export an query result to a csv format flat file in ms access, the text fields are enclosed in quotes. Is it possible to export the text fields values without quotes?
Yes it is possible:
During the export process flow you will have the option to select your own custom formatting and layout. Select this check box and then you will have the opportunity to select whatever delimiter you see fit. See this article for further information.
Here is also an example of how you can write it to a file manually using VBA.
Enjoy!
How can I load 10,000 rows of test.xls file into mysql db table?
When I use below query it shows this error.
LOAD DATA INFILE 'd:/test.xls' INTO TABLE karmaasolutions.tbl_candidatedetail (candidate_firstname,candidate_lastname);
My primary key is candidateid and has below properties.
The test.xls contains data like below.
I have added rows starting from candidateid 61 because upto 60 there are already candidates in table.
please suggest the solutions.
Export your Excel spreadsheet to CSV format.
Import the CSV file into mysql using a similar command to the one you are currently trying:
LOAD DATA INFILE 'd:/test.csv'
INTO TABLE karmaasolutions.tbl_candidatedetail
(candidate_firstname,candidate_lastname);
To import data from Excel (or any other program that can produce a text file) is very simple using the LOAD DATA command from the MySQL Command prompt.
Save your Excel data as a csv file (In Excel 2007 using Save As) Check
the saved file using a text editor such as Notepad to see what it
actually looks like, i.e. what delimiter was used etc. Start the MySQL
Command Prompt (I’m lazy so I usually do this from the MySQL Query
Browser – Tools – MySQL Command Line Client to avoid having to enter
username and password etc.) Enter this command: LOAD DATA LOCAL INFILE
‘C:\temp\yourfile.csv’ INTO TABLE database.table FIELDS TERMINATED
BY ‘;’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\r\n’ (field1, field2);
[Edit: Make sure to check your single quotes (') and double quotes (")
if you copy and paste this code - it seems WordPress is changing them
into some similar but different characters] Done! Very quick and
simple once you know it :)
Some notes from my own import – may not apply to you if you run a different language version, MySQL version, Excel version etc…
TERMINATED BY – this is why I included step 2. I thought a csv would default to comma separated but at least in my case semicolon was the deafult
ENCLOSED BY – my data was not enclosed by anything so I left this as empty string ”
LINES TERMINATED BY – at first I tried with only ‘\n’ but had to add the ‘\r’ to get rid of a carriage return character being imported into the database
Also make sure that if you do not import into the primary key field/column that it has auto increment on, otherwhise only the first row will be imported
Original Author reference
I am doing an export from a MySQL result-set and what I am finding in the .txt file when I open it in Notepad++ is there are fields that looked like this Top Side Panel w/ Bracket, Left now look like this "Top Side Panel w/ Bracket, Left" with extra quotes.
This is only happening on the fields with a comma in them. So it does not occur on a record with this in the same field for example: Rear Baffle
How do you do a correct Tab Delimited export from MySQL Query Browser 1.2.17 where we do not get added data!?
Thank you.
You can use MySQL's SELECT INTO OUTFILE syntax to give you a native MySQL way to generate CSV or TSV files. This command gives you full control over how you delineate and escape your fields. See the link below for documentation.
http://dev.mysql.com/doc/refman/5.5/en/select-into.html
I recommend to use phpMyAdmin. It offers an export tool that exports csv for MS Excel.
I have an excel file that i need to get into CSV. I export it fine but when I go to import it into a mysql db via phpMyAdmin i get a "Invalid field count in CSV input on line 1.".
Problem seems to be that the fields are not enclosed by double quotes. I just migrated to MS Excel 2007 and am not sure how to manipulate the CSV save options so that there are double quotes around the fields so my DB doesn't throw a conniption when i try to import.
Any suggestions? I'm fairly new at going from EXCEL to CSV but have gotten it to work previously.
Thanks
This worked for me after exporting from Excel as CSV and defining various options
load data infile '/tmp/tc_t.csv'
into table new_test_categories
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
ignore 1 lines
(id,category_name,type_id,home_collection,seo_tags,status_id);
I ran this at the mysql prompt.
There should be an MS-DOS format of CSV in your export drop down. Pick that one.
There should be an option in save-as advanced properties or something, but if not, you could always change the delimiter character to : or ; or | and then write a quick perl script to convert it to a quote-and-comma file.
Or you could just try a tab-separated-value file instead, I think phpMyAdmin will read TSVs as well.