SQL script for importing data (from Excel) without going through the Import Data Wizard | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

SQL script for importing data (from Excel) without going through the Import Data Wizard

Whilst I am able to import data through the wizards pretty easily, I want to automate this process. Is there a way to create a script within SQL which does the same thing? Thanks.

31st Jul 2021, 6:25 AM
Jin
Jin - avatar
1 Answer
+ 5
You can construct individual INSERT statement for each record that you want to load, for example with an excel formula concatenating the values with commas. Or you can save your data as csv or tsv, then use LOAD DATA statement. https://chartio.com/resources/tutorials/excel-to-mysql/ https://dev.mysql.com/doc/refman/8.0/en/load-data.html Or you can use the mysqlimport utility. https://dev.mysql.com/doc/refman/8.0/en/mysqlimport.html
31st Jul 2021, 6:36 AM
Tibor Santa
Tibor Santa - avatar