开发者

Excel CSV to Mysql Database

开发者 https://www.devze.com 2023-01-20 21:03 出处:网络
i am planning to get some Data Entry done for the records of Restaurant info which i later want to upload to MySQL table.

i am planning to get some Data Entry done for the records of Restaurant info which i later want to upload to MySQL table.

Is t开发者_开发知识库here some kinda rules i need to follow because i read some place that we have to mention some kinda delimiter like , ; etc. not sure how to do that in Excel.

Secondly can i use Google Forms which stores question into Google sheets for doing the same as filling the form will be a lot faster and typing it out in excel :D


You can save the file (in Excel and also in Google spreadsheet) as a CSV. You can load the CSV into mysql using the LOAD DATA INFILE syntax. For example:

LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table
FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\\'
LINES TERMINATED BY '\n' STARTING BY ''

http://dev.mysql.com/doc/refman/5.1/en/load-data.html


Excel is the enemy of database programmers. If you simply ask someone to fill in an Excel spreadsheet expect 1) data in the wrong column for some rows, 2) text in fields that must be numbers (eg "bet 10 and 20", 3) Incomplete date fields (eg "10/2010"), text that is too long to fit your column definition and other problems.

However, if you have clean data you can Save As CSV in Excel and that will produce a file that any tool that can read CSV will be able to parse and load.

0

精彩评论

暂无评论...
验证码 换一张
取 消