Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

Automatically import .csv file to database

Eisram's profile image Eisram posted 3 months ago in General Permalink

Hello,

I need to import a .csv file into HeidiSQL automatically, preferrebly via batch file or something task scheduler compatible.

I know there already is a topic about this question but it was asked 6 years ago. It would be awesome if someone could help since I tried to realise a solution for the past week or so...

ansgar's profile image ansgar posted 3 months ago Permalink

You cannot automate CSV imports in HeidiSQL that way.

I recommend to invoke a mysql command line instead, executing such a command per task scheduler:

mysql -hlocalhost -uroot --execute="LOAD DATA LOCAL INFILE 'C:\\temp\\whatever.csv'
   INTO TABLE mydb.mytable
   CHARACTER SET utf8 FIELDS TERMINATED BY ';' optionally ENCLOSED BY '"' ESCAPED BY '"' LINES TERMINATED BY '\n'
   (col1, col2, col3, ...);"
Eisram's profile image Eisram posted 3 months ago Permalink

Thanks so much :) I will try it as soon as I can!

Please login to leave a reply, or register at first.




Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.