Subject: Useful tool - CSV to MySQL

Posted on: 18/10/06 06:30pm
By: Anon

You may have covered this elsewhere but I couldn't find it.

I had spreadsheets set up in Excel that I wanted to use as the basis for content in the Contacts plug in. After hours messing about getting the data into the right format (all columns identical to the table headings) I then found that it would not let me import the CSV file into my database.

I searched for ages to find something to import CSV into MySQL, then stumbled across here - it picks up your csv file off your computer and quickly translates it into MySQL (save as a .txt file) so that you can then run the MySQL command into your database.

This may be of use to someone.

Anon

Re: Useful tool - CSV to MySQL

Posted on: 16/10/07 02:07am
By: Anonymous

Thanks for that! Saved me a bunch of work.

Re: Useful tool - CSV to MySQL

Posted on: 21/08/08 01:34am
By: Anonymous

Thank you for your time and trouble .

Should have looked for this earlier. I have been trying to import a CSV for the last 6 hrs :banghead:

Re: Useful tool - CSV to MySQL

Posted on: 11/09/08 06:19am
By: Anonymous

Great! Thanks :chestslam:

Good topic name, easy to found on google Big Grin
Regards!

Re: Useful tool - CSV to MySQL

Posted on: 27/05/09 09:24am
By: Anonymous

DUUUUDE :banana:

THANKS A LOT>.. can;t belive how usefull this was.

Congrats for the post... i'll ship you a 6pack of beer Big Grin

Re: Useful tool - CSV to MySQL

Posted on: 28/05/09 09:15am
By: Anonymous

Thank you so much! Awesome find, saved me a ton of time!

Re: Useful tool - CSV to MySQL

Posted on: 06/11/09 07:47am
By: Anonymous

Hi, Thanks a lot. It rescued me from long sleepless nights. thanks a lot for sharing.

Re: Useful tool - CSV to MySQL

Posted on: 10/11/09 02:02pm
By: Anonymous

any other "csv2mysql" or "xls2mysql" freeware-tool that you know of?

my file is larger than 2MB

thx

Re: Useful tool - CSV to MySQL

Posted on: 21/11/09 05:09pm
By: MoneyTopList

I use for such cases software called BK ReplaceEM. It can replace some part of the text by another parts. Sure, if you found something special which converts CSV to MySQL it is better, however, many people often need similar changes and it may be easier to do it with such software than spending a lot of time by searching for something special.

Re: Useful tool - CSV to MySQL

Posted on: 08/12/09 01:35pm
By: Anonymous

Holy crap that is awesome. saved me soooo much time.

BTW captcha on this site SUCKS. makes some better images.

Re: Useful tool - CSV to MySQL

Posted on: 29/01/10 05:07am
By: Anonymous

Thanks mate :-)

You're post came right on top off google :-)

Re: Useful tool - CSV to MySQL

Posted on: 10/04/10 02:05pm
By: Anonymous

very very thanks.

Anon.

You done a great thing.

Re: Useful tool - CSV to MySQL

Posted on: 25/04/10 11:39am
By: Anonymous

Dear
another good tool for Excel7CSV import is http://www.dbTube.org
You can draw your import definition online with an workflow
editor. The generated improt definition can be used for your further
imports.

greetings

Andreas

Re: Useful tool - CSV to MySQL

Posted on: 01/07/10 04:56am
By: Anonymous

http://kedar.nitty-witty.com/blog/load-delimited-data-csv-excel-into-mysql-server/

Re: Useful tool - CSV to MySQL

Posted on: 30/08/10 12:54am
By: Anonymous

Nice! Couple more methods: http://giantdorks.org/alain/export-mysql-data-into-csv-or-psv-files/

Re: Useful tool - CSV to MySQL

Posted on: 30/08/10 12:59am
By: Anonymous

Hmm, let's see if I can get a link going: Export (and Import) MySQL data into CSV or PSV files :banghead:

Re: Useful tool - CSV to MySQL

Posted on: 22/09/10 03:14am
By: Anonymous

Please send me the correct link for your post so that I can use it.
I have also the same problem. Thanx

Re: Useful tool - CSV to MySQL

Posted on: 30/11/10 02:20am
By: Anonymous

mysql dbu is closed.
Any other alternative ?

Re: Useful tool - CSV to MySQL

Posted on: 02/12/10 05:32pm
By: Anonymous

You might try this link. There are a number of links to real software to suit this conversion requirement.

http://mysql-import-multiple-text-files-softwar.software.informer.com/

Often these sites are dynamic in nature so there's no guarantee as to how long the link will work.

CSV storage engine

Posted on: 03/12/10 07:05am
By: Anonymous

If you have access to the data folder a simple alternative is to make a table of type CSV. (normally you have isam or innodb). Instantly you have the csv file in the folder. Just copy your data into it and its available in mysql or insert data into it using mysql and you have it in csv formt.

hope this helps,

Re: Useful tool - CSV to MySQL

Posted on: 16/12/10 07:15pm
By: Anonymous

http://csv2sql.com/

Re: Useful tool - CSV to MySQL

Posted on: 22/12/10 08:03am
By: Anonymous

http://www.agilefuseconsulting.co.cc/development/csvtomysql/

this is my tool. i developed the tool using html5 and file api. please take note that this only works on firefox and google chrome browser(latest version). also large data to import requires large time to complete, and also may cause memory limit error. so please use the tool with care. thanks.

Re: Useful tool - CSV to MySQL

Posted on: 08/01/11 05:24pm
By: Anonymous

seems most online tools have been taken down or dont work, but found I found this basic (and free) site convertcsvtomysql.com

seems limited but was enough for my needs, i think its still in dvelopment too

Re: Useful tool - CSV to MySQL

Posted on: 15/02/11 07:49am
By: Anonymous

thanks man..

Re: Useful tool - CSV to MySQL

Posted on: 09/05/11 08:37am
By: Anonymous

Here is a PHP function that does the trick:
PHP Formatted Code

function csv_file_to_mysql_table($source_file, $target_table, $max_line_length=10000) {
        if (($handle = fopen("$source_file", "r")) !== FALSE) {
                $columns = fgetcsv($handle, $max_line_length, ",");
                foreach ($columns as &$column) {
                        $column = str_replace(".","",$column);
                }
                $insert_query_prefix = "INSERT INTO $target_table (".join(",",$columns).")\nVALUES";
                while (($data = fgetcsv($handle, $max_line_length, ",")) !== FALSE) {
                        while (count($data)<count($columns))
                                array_push($data, NULL);
                        $query = "$insert_query_prefix (".join(",",quote_all_array($data)).");";
                        mysql_query($query);
                }
                fclose($handle);
        }
}
 

Re: Useful tool - CSV to MySQL

Posted on: 04/08/11 04:00pm
By: Anonymous

This function won't work unless you've got your own function for quote_all_array() - that isn't a built-in PHP function. This works pretty well:
PHP Formatted Code

function quote_all_array($arr)
{
        foreach ($arr as $k=>$v)
        {
               
                $returnArr[$k] = ($v) ? '"'.str_replace('"','\"',$v).'"' : "NULL" ;
        }      
        return $returnArr;
}
 

Re: Useful tool - CSV to MySQL

Posted on: 23/08/11 03:10am
By: MyJuliet

Please give me the correct link to your article, so I can use it. I have the same problem.

Re: Useful tool - CSV to MySQL

Posted on: 01/09/11 01:30am
By: Anonymous

Hi,

maybe the phpBlocks lib can solve the export/inport of CSV files in a more
smart way like Googles AppInventor. You can change the export format in an
Click&Point manner. Like Google AppInventor or the programming IDE Scratch
from the MIT.

phpBlocks is GPL and can be downloaded from the WebSite. Worth a look for dyn.
PHP formular and exports.

Common Demos: http://www.freegroup.de/software/phpBlocks/demo.html
Link to example: http://www.freegroup.de/test/editor/editor.php?xml=demo_sql.xml

Greetings

Andreas


Re: Useful tool - CSV to MySQL

Posted on: 18/05/12 01:52pm
By: Anonymous

For anyone wondering what was on the original mysqlDBU site... here it is in the internet archive http://web.archive.org/web/20100912102607/http://www.sqldbu.com/eng/sections/tips/mysqlimport.html it was a web-based solution Rolling Eyes

Re: Useful tool - CSV to MySQL

Posted on: 08/08/12 04:12am
By: Anonymous

If you would like to pre-validate and rollback on errror - you might like check out this post/tip on CSV import from Excel to MySQL

http://leansoftware.net/tabid/123/g/posts/t/17/How-to-validate-and-upload-CSV--comma-seperated-value--data-to-a-database.aspx

Could save you some time - this is a professional tool - free for 60 days

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=71161