Search code examples
sqlexcelimportsquirrel-sql

Import from Excel to MySQL database using SQuirrel


I have an Excel spreadsheet with a few thousand entries in it. I want to import the table into a MySQL 4 database (that's what I'm given). I am using SQuirrel for GUI access to the database, which is being hosted remotely.

Is there a way to load the columns from the spreadsheet (which I can name according to the column names in the database table) to the database without copying the contents of a generated CSV file from that table? That is, can I run the LOAD command on a local file instructing it to load the contents into a remote database, and what are the possible performance implications of doing so?

Note, there is a auto-generated field in the table for assigning ids to new values, and I want to make sure that I don't override that id, since it is the primary key on the table (as well as other compound keys).


Solution

  • If you only have a few thousand entries in the spreadsheet then you shouldn't have performance problems (unless each row is very large of course).

    You may have problems with some of the Excel data, e.g. currencies, best to try it and see what happens.

    Re-reading your question, you will have to export the Excel into a text file which is stored locally. But there shouldn't be any problems loading a local file into a remote MySQL database. Not sure whether you can do this with Squirrel, you would need access to the MySQL command line to run the LOAD command.

    The best way to do this would be to use Navicat if you have the budget to make a purchase?