Can any one explain how to import a Microsoft Excel file in to a MySQL database?
For example, my Excel table looks like this:
Country | Amount | Qty
----------------------------------
America | 93 | 0.60
Greece | 9377 | 0.80
Australia | 9375 | 0.80
asked Aug 21, 2009 at 5:07
11
There’s a simple online tool that can do this called sqlizer.io.
You upload an XLSX file to it, enter a sheet name and cell range, and it will generate a CREATE TABLE statement and a bunch of INSERT statements to import all your data into a MySQL database.
(Disclaimer: I help run SQLizer)
answered Sep 22, 2014 at 16:40
d4ntd4nt
15.3k9 gold badges40 silver badges51 bronze badges
9
Below is another method to import spreadsheet data into a MySQL database that doesn’t rely on any extra software. Let’s assume you want to import your Excel table into the sales
table of a MySQL database named mydatabase
.
-
Select the relevant cells:
-
Paste into Mr. Data Converter and select the output as MySQL:
-
Change the table name and column definitions to fit your requirements in the generated output:
CREATE TABLE sales (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
Country VARCHAR(255),
Amount INT,
Qty FLOAT
);
INSERT INTO sales
(Country,Amount,Qty)
VALUES
('America',93,0.60),
('Greece',9377,0.80),
('Australia',9375,0.80);
-
If you’re using MySQL Workbench or already logged into
mysql
from the command line, then you can execute the generated SQL statements from step 3 directly. Otherwise, paste the code into a text file (e.g.,import.sql
) and execute this command from a Unix shell:mysql mydatabase < import.sql
Other ways to import from a SQL file can be found in this Stack Overflow answer.
answered Mar 24, 2017 at 4:16
thdoanthdoan
18.3k1 gold badge58 silver badges51 bronze badges
2
-
Export it into some text format. The easiest will probably be a tab-delimited version, but CSV can work as well.
-
Use the load data capability. See http://dev.mysql.com/doc/refman/5.1/en/load-data.html
-
Look half way down the page, as it will gives a good example for tab separated data:
FIELDS TERMINATED BY ‘t’ ENCLOSED BY » ESCAPED BY »
-
Check your data. Sometimes quoting or escaping has problems, and you need to adjust your source, import command— or it may just be easier to post-process via SQL.
ashatte
5,4128 gold badges38 silver badges50 bronze badges
answered Aug 21, 2009 at 5:13
ndpndp
21.4k5 gold badges35 silver badges52 bronze badges
6
There are actually several ways to import an excel file in to a MySQL database with varying degrees of complexity and success.
-
Excel2MySQL. Hands down, the easiest and fastest way to import Excel data into MySQL. It supports all verions of Excel and doesn’t require Office install.
-
LOAD DATA INFILE: This popular option is perhaps the most technical and requires some understanding of MySQL command execution. You must manually create your table before loading and use appropriately sized VARCHAR field types. Therefore, your field data types are not optimized. LOAD DATA INFILE has trouble importing large files that exceed ‘max_allowed_packet’ size. Special attention is required to avoid problems importing special characters and foreign unicode characters. Here is a recent example I used to import a csv file named test.csv.
-
phpMyAdmin: Select your database first, then select the Import tab. phpMyAdmin will automatically create your table and size your VARCHAR fields, but it won’t optimize the field types. phpMyAdmin has trouble importing large files that exceed ‘max_allowed_packet’ size.
-
MySQL for Excel: This is a free Excel Add-in from Oracle. This option is a bit tedious because it uses a wizard and the import is slow and buggy with large files, but this may be a good option for small files with VARCHAR data. Fields are not optimized.
answered Aug 30, 2014 at 1:50
panofishpanofish
7,51013 gold badges54 silver badges96 bronze badges
5
Not sure if you have all this setup, but for me I am using PHP and MYSQL. So I use a PHP class PHPExcel. This takes a file in nearly any format, xls, xlsx, cvs,… and then lets you read and / or insert.
So what I wind up doing is loading the excel in to a phpexcel object and then loop through all the rows. Based on what I want, I write a simple SQL insert command to insert the data in the excel file into my table.
On the front end it is a little work, but its just a matter of tweaking some of the existing code examples. But when you have it dialed in making changes to the import is simple and fast.
answered Oct 6, 2014 at 18:26
1
the best and easiest way is to use «MySQL for Excel» app that is a free app from oracle. this app added a plugin to excel to export and import data to mysql. you can download that from here
answered May 26, 2015 at 7:03
When using text files to import data, I had problems with quotes and how Excel was formatting numbers. For example, my Excel configuration used the comma as decimal separator instead of the dot.
Now I use Microsoft Access 2010 to open my MySql table as linked table. There I can simply copy and paste cells from Excel to Access.
To do this, first install the MySql ODBC driver and create an ODBC connection.
Then in access, in the «External Data» tab, open «ODBC Database» dialog and link to any table using the ODBC connection.
Using MySql Workbench, you can also copy and paste your Excel data into the result grid of MySql Workbench. I gave detailed instructions in this answer.
answered Nov 12, 2014 at 10:39
Christophe WeisChristophe Weis
2,4984 gold badges28 silver badges32 bronze badges
Fastest and simpliest way is to save XLS as ODS (open document spreasheet) and import it from PhpMyAdmin
answered Nov 15, 2020 at 5:41
Daniel DDaniel D
791 silver badge4 bronze badges
For a step by step example for importing Excel 2007 into MySQL with correct encoding (UTF-8) search for this comment:
«Posted by Mike Laird on October 13 2010 12:50am»
in the next URL:
http://dev.mysql.com/doc/refman/5.1/en/load-data.html
answered Aug 12, 2014 at 19:52
Raúl MorenoRaúl Moreno
3133 silver badges14 bronze badges
You could use DocChow, a very intuitive GIU for importing Excel into MySQL, and it’s free on most common platforms (including Linux).
More especially if you are concerned about date, datetime datatypes, DocChow easily handles datatypes. If you are working with multiple Excel spreadsheets that you want to import into one MySQL table DocChow does the dirty work.
answered Dec 15, 2014 at 21:19
Step 1 Create Your CSV file
Step 2 log in to your mysql server
mysql -uroot -pyourpassword
Step 3
load your csv file
load data local infile '//home/my-sys/my-excel.csv' into table my_tables fields terminated by ',' enclosed by '"' (Country, Amount,Qty);
answered Oct 5, 2018 at 12:07
Syed ShibliSyed Shibli
9821 gold badge12 silver badges15 bronze badges
0
Another useful tool, and as a MySQL front-end replacement, is Toad for MySQL. Sadly, no longer supported by Quest, but a brilliant IDE for MySQL, with IMPORT and EXPORT wizards, catering for most file types.
answered Jul 26, 2019 at 1:17
Fandango68Fandango68
4,2893 gold badges38 silver badges69 bronze badges
If you are using Toad for MySQL steps to import a file is as follows:
- create a table in MySQL with the same columns that of the file to be imported.
- now the table is created, goto > Tools > Import > Import Wizard
- now in the import wizard dialogue box, click Next.
- click Add File, browse and select the file to be imported.
- choose the correct dilimination.(«,» seperated for .csv file)
- click Next, check if the mapping is done properly.
- click Next, select the «A single existing table» radio button also select the table that to be mapped from the dropdown menu of Tables.
- Click next and finish the process.
answered Dec 24, 2020 at 12:15
tushar_lokaretushar_lokare
4611 gold badge8 silver badges22 bronze badges
If you don’t like plugins, VBA and external tools, I have an excel file that using formulas only allows you to create INSERT/UPDATES. You only have to put the data on the cells:
As an extra, there’s another tab in the file to CREATE TABLES:
The file can be found on the following link:
EXCEL FILE
answered Apr 19, 2021 at 3:58
KaiserKaiser
1,9271 gold badge19 silver badges27 bronze badges
I’ve had good results with the Tools / Import CSV File feature in HeidiSQL, with CSV files directly exported from Excel 2019 with «Save As…»
It uses LOAD DATA INFILE internally but with a GUI interface and also analyzes the CSV file before passing it to LOAD DATA INFILE so it can, for example, create the table using the first row as column names and guessing the column data type (<New table> option as shown in the picture)
answered Apr 11, 2022 at 7:46
golimargolimar
2,3711 gold badge22 silver badges33 bronze badges
Microsoft Excel has been a traditional choice as a spreadsheet application for organizations across the world. The ease of access, power formulas, and the ability to make visually stunning reports has made Microsoft Excel is widely used tool. However, managing thousands of sheets can be a time-consuming and resource-intensive task that may also lead to some errors. A good solution is to import your Excel files to a scalable, reliable, and fast relational database management system like MySQL.
You can Import Excel into MySQL either by using simple SQL commands like LOAD DATA or opt for third-party tools. By importing your Excel files to MySQL, you can leverage the powerful MySQL engine to quickly query data and perform complex data manipulations.
In this article, you will learn how to effectively Import Excel into MySQL using 4 different methods.
What is Microsoft Excel?
Microsoft Excel is a spreadsheet application developed by Microsoft to organize and record data in a tabular format. Launched in 1985, Microsoft Excel is a widely used Spreadsheet software in businesses worldwide allowing you to organize and manipulate data through formulas in columns and rows. MS Excel is loaded with functionalities to perform several operations such as calculations, pivot tables, graph tools, etc.
Compatible with Microsoft Windows, macOS, Android, and iOS, MS Excel is included with the MS Office Suite. It is typically used by firms to record, organize and analyze financial data. MS Excel also offers VBA programming that can assist you in automating repetitive tasks.
Key Features of Microsoft Excel
- Conditional Formatting: MS Excel allows you to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula.
- Built-in Formulae: MS Excel provides you with basic and advanced built-in formulae for sum, average, minimum, etc. You can use formula auditing to graph or trace the relationship between cells and formulas with blue arrows. You can track precedents (cells that provide data for a particular cell) or the cells that depend on the value of a particular cell.
- Data Protection: Excel spreadsheets can be password protected on your laptop or PC. MS Excel also provides a robust system to recover data.
- Data Sorting & Filtering: You can easily perform the basic data sorting and filtering operation on your data in excel. MS Excel also provides Advanced filtering options for complex criteria.
What is MySQL?
MySQL is a popular Open-Source Relational Database Management System. MySQL data is stored in tables consisting of rows and columns. Introduced in 1995, MySQL is completely developed, distributed, and maintained by Oracle Corporation. Looking over the technical side, MySQL is written in the C and C ++ languages.
MySQL is compatible with multiple platforms such as Microsoft Windows, Oracle Solaris, AIX, Symbian, Linux, and macOS. You can use SQL commands to retrieve, change or add data from your MySQL tables. MySQL is also a vital component of the Modern LAMP stack, which consists of a Linux-based Operating System, Apache Web Server, MySQL Database, and PHP for processing.
SQL can also be used to define the table schema or even configure the relationship between the tables in the database. Client-Side Graphical User Interfaces such as MySQL WorkBench, SequelPro, or DBVisualizer can be used to type the SQL commands and the server will respond with the requested information. MySQL also offers a paid Enterprise version which includes premium support services and several extensions that can be installed as Server Plugins.
Key Features of MySQL
MySQL is widely used by organizations like Facebook, Flickr, Twitter, Wikipedia, and YouTube. This is due to the following set of MySQL’s eye-catching features:
- Ease of Operation: With MySQL, you can work with a diverse set of programming languages such as PHP, PERL, C, C ++, and JAVA. It also provides a set of intuitive tools to simplify time-consuming tasks such as Server Management, Reporting, and Data Analysis.
- Support for Several Data Structures: Allowing you to work with a broader range of datasets, MySQL offers full support for several Data structures like JSON and Geospatial data, as well as Logical, Numeric, Alphanumeric, Date, and Time data types.
- First-rate Performance: MySQL delivers best-in-class query performance across a variety of clustered servers. It provides a fast-loading utility with a separate memory cache and table index partitioning. MySQL can also efficiently handle fluctuating workloads and process large volumes of data at optimal speeds. This allows you to store more than 50 million rows of data in a table with a table’s default file size limit of 4 GB which can be increased to a theoretical limit of 8 million terabytes (TB).
- Open-Source: MySQL is under the GNU General Public License (GPL), which means it will always be freely available. It provides you the freedom to customize it on Oracle’s Open-Source MySQL codebase based on your needs.
- Localization: To make it user-friendly, MySQL supports multiple character sets, including latin1 (cp1252), german, big5, ujis, and more. You can also set the error message language that the server provides to the client.
- Data Security: MySQL provides full control over the Data Access Control settings. Robust mechanisms such as Access Privilege Systems and User Account Management allow you to regulate who can view or use your MySQL data. MySQL sets the highest standard with Host-based Verification and Password Encryption.
Why should you import Excel into MySQL?
Microsoft Excel is an easy-to-use spreadsheet application that allows you to directly access data and perform a combination of operations on this data. As you collect data and store it in your separate excel files, it becomes a huge task to track each sheet with millions of records in it. To simplify this, you can import Excel into MySQL. MySQL is a scalable, fast, and reliable database management system that allows you to store and query millions of rows of data using simple SQL commands.
Using MYSQL, you can also connect your Excel tables with one another tables using primary and foreign keys. MySQL can easily handle large datasets and allows you to manipulate data, filter data, update data and combine it. You can import Excel into MySQL and enjoy better speed, accuracy, & consistency for your ever-growing data needs.
MySQL is a popular Open-Source Relational Database Management system that allows you to effectively store your Excel file data and manage it using simple SQL commands or via its simple user interface MySQL Workbench. To import Excel into MySQL, check out the following four methods:
Method 1: Using Hevo Data to Import Excel into MySQL
Hevo Data, an Automated Data Pipeline, provides you a hassle-free solution to easily load data from 150+ data sources (including 40+ free sources like Google Sheets) to your desired destination such as MySQL, Data Warehouses, or BI tools in a completely hassle-free & automated manner. Using Hevo you can easily upload your Excel files present on your Google Drive to your MySQL Database in just a few clicks.
Get Started with Hevo for Free
Hevo is fully managed and completely automates the process of not only loading data from 150+ data sources but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code.
Method 2: Using Sqlizer.io to Import Excel into MySQL
This method requires you to upload your Excel files that will be converted into SQL commands. You need to copy the SQL statements and execute them on MySQL Workbench. This method is only effective if you’re dealing with small Excel files with a few records that requires zero data transformation.
Method 3: Using the Load Data Statement to Import Excel into MySQL
This method would be time-consuming and somewhat tedious to implement. Users will have to write custom SQL statements & use the MySQL Workbench to import excel into MySQL. This method is suitable for users with a technical background.
Method 4: Import Excel into MySQL using phpMyAdmin
This method would require you to install the phpMyAdmin database administration tool to import Excel into MySQL. This tool is a good option if you require to perform data transfer once in a while with little to no data transformation.
- Method 1: Using Hevo Data to import Excel into MySQL
- Method 2: Using Sqlizer.io to Import Excel into MySQL
- Method 3: Using the Load Data Statement to Import Excel into MySQL
- Method 4: Import Excel into MySQL using phpMyAdmin
Method 1: Using Hevo Data to import Excel into MySQL
Hevo Data is a No-code Data Pipeline solution that can help you move data from 150+ data sources (including 40+ free sources like Google Drive & Google Sheets) to your desired destination such as MySQL, Data Warehouses, or BI tools in a completely hassle-free & automated manner. Using Hevo you can easily upload your Excel files present on your Google Drive to your MySQL Database.
Hevo also supports MySQL as a Source for loading data to a destination of your choice. Hevo is fully managed and completely automates the process of not only loading data from 150+ data sources but also enriching the data and transforming it into an analysis-ready form without having to write a single line of code. Its fault-tolerant architecture ensures that the data is handled in a secure, consistent manner with zero data loss.
Hevo Data takes care of all your data preprocessing needs and lets you focus on key business activities and draw a more powerful insight on how to generate more leads, retain customers, and take your business to new heights of profitability. It provides a consistent & reliable solution to manage data in real-time and always have analysis-ready data in your desired destination.
Take a look at some of the salient features of Hevo:
- Blazing-fast Setup: Straightforward interface for new customers to work on, with minimal setup time.
- Reliability at Scale – With Hevo, you get a world-class fault-tolerant architecture that scales with zero data loss and low latency.
- Monitoring and Observability – Monitor pipeline health with intuitive dashboards that reveal every stat of pipeline and data flow. Bring real-time visibility into your ELT with Alerts and Activity Logs
- Stay in Total Control – When automation isn’t enough, Hevo offers flexibility – data ingestion modes, ingestion, and load frequency, JSON parsing, destination workbench, custom schema management, and much more – for you to have total control.
- Transparent Pricing – Say goodbye to complex and hidden pricing models. Hevo’s Transparent Pricing brings complete visibility to your ELT spend. Choose a plan based on your business needs. Stay in control with spend alerts and configurable credit limits for unforeseen spikes in data flow.
- Auto-Schema Management – Correcting improper schema after the data is loaded into your warehouse is challenging. Hevo automatically maps source schema with destination warehouse so that you don’t face the pain of schema errors.
- 24×7 Customer Support – With Hevo you get more than just a platform, you get a partner for your pipelines. Discover peace with round the clock “Live Chat” within the platform. What’s more, you get 24×7 support even during the 14-day full-feature free trial.
Sign up here for a 14-Day Free Trial!
Without the need for converting your .xlsx file to .csv, you effortlessly import Excel into MySQL using Hevo by following the simple steps given below:
- Step 1: Upload your Excel files into your Google Drive.
- Step 2: Login to Hevo and naviagte to Pipleines > + Create. Select Google Drive as your Source and configure your Drive account by selecting the authentication method for connecting to Google Drive.
- Step 3: Finally, provide a name for your Pipeline and select all the folders whose Excel files you want to import to MySQL. Then, click on the Continue button.
- Step 4: For completing the process to import Excel into MySQL, you can start by providing your MySQL database credentials such as your authorized Username and Password, along with information about your Host IP Address and Port Number value. You will also need to provide a name for your database and a unique name for this destination.
Method 2: Using Sqlizer.io to Import Excel into MySQL
To import Excel into MySQL, you can use Sqlizer.io to convert your Excel files into SQL commands. You can achieve this by following the simple instructions given below:
- Step 1: Click on the Browse button and select the Excel file you want to import to MySQL.
- Step 2: Select MySQL as your desired database. According to your excel file, check or uncheck My File has a Header Row.
- Step 3: Based on your Excel file, check Use CHECK IF TABLE EXISTS. For using the active worksheet, check the Use the active worksheet box.
- Step 4: You can also choose to enter the Worksheet name. For this example, the worksheet name Students is mentioned.
- Step 5: To import Excel into MySQL, you can either provide the data cell range or check the Convert the whole worksheet box to import the whole data.
- Step 6: Finally, name the table in which to import excel into MySQL. Then, click on the Convert My File button.
- Step 7: After your file is converted, you will get the following message. Now, download the queries or you can even copy the queries to execute them on MySQL.
After the queries have been executed, you can view your data in MySQL using the SELECT command.
Method 3: Using the Load Data Statement to Import Excel into MySQL
Using the LOAD DATA Statement, you can import Excel data into MySQL. To do that, follow the simple steps given below:
- Step 1: You have to first convert your .xlsx file to .csv file. For that, open up the excel file that you need to import.
- Step 2: Navigate to File > Save As. Select CSV (Comma delimited)(*.csv) as your file type and click on the Save button.
- Step 3: Now, enter the LOAD DATA command shown below in your MySQL Workbench import Excel into MySQL.
# MySQL Version 8.0.27
LOAD DATA INFILE
'C:/ProgramFiles/MySQLExcel/import excel into mysql.csv'
INTO TABLE new_file
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY 'n'
IGNORE 1 ROWS;
In the above process to import an excel file in MySQL workbench, the .csv file data will be added to the new_file table in your MySQL database without the first row as it contains the row headers. For this example, the .csv file uses a comma as the delimiter to separate 2 fields. You can also use FIELDS TERMINATED BY ‘t’ or FIELDS TERMINATED BY ‘ ‘ if your file’s fields are separated using a tab or a single space respectively.
Alternatively, you can use the LOAD DATA command directly from the Command Line (CMD).
Method 4: Import Excel into MySQL using phpMyAdmin
You can also import excel into MySQL using phpMyAdmin by first converting your .xlsx files to .csv files. For that, you have to first download and phpMyAdmin tool on your system. For this example, a new table named tb_students_phpmyadmin has been created in the MySQL Database. To import excel into MySQL, you can follow the simple steps given below:
- Step 1: In phpMyAdmin, click on the Import tab and choose your desired .csv file.
- Step 2: Now, enter the format-specific options and once you are done, click on the Go button present in the bottom right corner of your screen.
After clicking on the Go button, you will observe the data import confirmation messages for all your rows.
- Step 3: Using the SELECT statement, you can check if the process to import excel into MySQL was successful or not.
Conclusion
In this article, you have learned how to effectively import Excel into MySQL using 4 different methods. Using Method 2, you convert your Excel file rows into SQL queries via sqlizer.io which you, later on, execute on your MySQL Workbench or Command-Line. Though this can be a time-consuming process if you are dealing with excel files containing thousands of rows. You can also use the LOAD DATA statement or a database administration tool like phpMyAdmin, though these require you to first convert the Excel files into CSV files.
These 3 methods are a good option if you only need to rarely import Excel into MySQL with no requirement for processes like Data Cleaning & Data Standardisation. However, when you need to frequently import excel files with millions of rows of data in real-time that require complex data transformation, then you can opt for a No-Code Automated Data Integration platform like Hevo Data!
Visit our Website to Explore Hevo
Hevo Data is a No-code Data Pipeline solution that can help you import data from a vast sea of sources like Google Drive to your desired destination such as MySQL, Data Warehouses, or BI tools. Using Hevo you can easily upload your Excel files present on your Google Drive to your MySQL Database. Hevo also supports MySQL as a Source for loading data to a destination of your choice. It is a reliable, completely automated, and secure service that doesn’t require you to write any code!
If you are using MySQL as your Database Management System and searching for a no-fuss alternative to manual data integration, then Hevo can effortlessly automate this for you. Hevo, with its strong integration with 150+ sources (Including 40+ Free Sources like Google Drive & Google Sheets), allows you to not only export & load data but also transform & enrich your data & make it analysis-ready in a jiffy.
Want to take Hevo for a ride? Sign Up for a 14-day free trial and simplify your Data Integration process. Do check out the pricing details to understand which plan fulfills all your business needs.
Tell us about your experience of completing the process to Import Excel into MySQL! Share your thoughts with us in the comments section below.
Sure Excel is used for spreadsheets, but did you know you can connect Excel to external data sources? In this article we’re going to discuss how to connect an Excel spreadsheet to a MySQL database table and use the data in the database table to populate our spreadsheet. There are a few things you need to do in order to prepare for this connection.
Preparation
First, you must download the most recent Open Database Connectivity (ODBC) driver for MySQL. The current ODBC driver for MySQL can be located at
https://dev.mysql.com/downloads/connector/odbc/
Make sure after you download the file that you check the file’s md5 hash against that listed on the download page.
Next, you will need to install the driver you just downloaded. Double click the file to start the install process. Once the install process is complete you will need to create a Database Source Name (DSN) to use with Excel.
Creating the DSN
The DSN will contain all of the connection information necessary to use the MySQL database table. On a Windows system, you will need to click on Start, then Control Panel, then Administrative Tools, then Data Sources (ODBC). You should see the following information:
Notice the tabs in the image above. A User DSN is only available to the user that created it. A System DSN is available to anyone that can log into the machine. A File DSN is a .DSN file that can be transported to and used on other systems that have the same OS and drivers installed.
To continue creating the DSN, click on the Add button near the top right corner.
You will probably have to scroll down to see the MySQL ODBC 5.x Driver. If it’s not present, something went wrong with installing the driver in the Preparation section of this post. To continue creating the DSN, make sure MySQL ODBC 5.x Driver is highlighted and click on the Finish button. You should now see a window similar to the one listed below:
Next you will need to supply the information necessary to complete the form shown above. The MySQL database and table we’re using for this post is on a development machine and is only used by one person. For “production” environments, it is suggested you create a new user and grant the new user SELECT privileges only. In the future, you can grant additional privileges if necessary.
After you have supplied the details for your data source configuration, you should click on the Test button to make sure everything is in working order. Next, click on the OK button. You should now see the data source name you supplied on the form in the previous set listed on the ODBC Data Source Administrator window:
Creating the Spreadsheet Connection
Now that you have successfully created a new DSN, you can close the ODBC Data Source Administrator window and open Excel. Once you have opened Excel, click on the Data ribbon. For newer versions of Excel, click on Get Data, then From Other Sources, then From ODBC.
In older versions of Excel, it’s a bit more of a process. Firstly, you should see something like this:
The next step is to click on the Connections link located right under the word Data in the tab list. The location of the Connections link is circled in red in the above image. You should be presented with the Workbook Connections window:
The next step is to click on the Add button. This will present you with the Existing Connections window:
Obviously you don’t want to work on any of the connections listed. Therefore, click on the Browse for More… button. This will present you with the Select Data Source window:
Just like the previous Existing Connections window, you do not want to use the connections listed in the Select Data Source window. Therefore, you want to double click on the +Connect to New Data Source.odc folder. In doing so, you should be now see the Data Connection Wizard window:
Given the data source choices listed, you want to highlight ODBC DSN and click Next. The next step of the Data Connection Wizard will display all of the ODBC data sources available on the system you are using.
Hopefully, if all as gone according to plan, you should see the DSN that you created in previous steps listed among the ODBC data sources. Highlight it and click on Next.
The next step in the Data Connection Wizard is to save and finish. The file name field should be auto filled for you. You can supply a description. The description used in the example is pretty self explanatory for anyone that might use it. Next, click on the Finish button in the lower right of the window.
You should now be back at the Workbook Connection window. The data connection you just created should be listed:
Importing the Table Data
You can close the Workbook Connection window. We need to click on the Existing Connections button in the Data ribbon of Excel. The Existing Connections button should be located to the left on the Data ribbon.
Clicking on the Existing Connections button should present you with the Existing Connections window. You’ve seen this window in previous steps, the difference now is that your data connection should be listed near the top:
Make sure the data connection you created in the previous steps is highlighted and then click on the Open button. You should now see the Import Data window:
For the purposes of this post, we are going to use the default settings on the Import Data window. Next, click on the OK button. If everything worked out for you, you should now be presented with the MySQL database table data in your worksheet.
For this post, the table we were working with had two fields. The first field is an auto-increment INT field titled ID. The second field is VARCHAR(50) and is titled fname. Our final spreadsheet looks likes like this:
As you’ve probably noticed, the first row contains the table column names. You can also use the drop down arrows next to the column names to sort the columns.
Wrap-Up
In this post we covered where to find the latest ODBC drivers for MySQL, how to create a DSN, how to create a spreadsheet data connection using the DSN and how to use the spreadsheet data connection to import data into an Excel spreadsheet. Enjoy!
Using Excel to MySQL conversion and synchronization tools.
When you start DBConvert or DBSync application in GUI mode it guides you through several steps to set up
the database migration or synchronization:
1. Connect to Excel source database.
If a source database requires you to log in, you can specify a
user name/ password and host/ port
parameters.
2. Connect to MySQL destination database.
Specifying parameters for destination database looks like the same as for source. Usually, it consists of
defining connection settings and username/password pairs.
NOTE #1: Every DBConvert or DBSync tool has two different
databases in its
name. That means any specified database from a pair can be set up as a source or destination.
Besides, the same type of database may be set up both as a source or destination.
As an example, here is the list of possible migration directions with on-premises databases:
- Excel to MySQL
- MySQL to Excel
- Excel to Excel
- MySQL to MySQL
NOTE #2: Don’t be confused by the fact that connections to
cloud databases like
Amazon RDS, Google Cloud, and Heroku are not explicitly
specified in the configuration of a source or destination in the DBConvert / DBSync
interface. To connect to Cloud database instances, use the same settings as you do for traditional
on-premises databases.
NOTE #3: Your connections to source and target databases stay active until you close
DBConvert/ DBSync application or reopen new connections on «source» and «destination» steps.
Read more about the specific
source/ destination configurations for different
databases.
3. Configure database migration options.
At the next step, you can specify precisely which tables, fields, indices, views you want to transfer to
the MySQL destination database. Just check/ uncheck the box in front of each
database object you want to convert.
Customize general database/ tables settings. Or set up a particular table , field, index individually when
migrating data from Excel to MySQL.
Check out our articles about Configure database migration options. for detailed information.
The screenshot below sums up general features available in DBConvert software solutions.
- Workaround
for firewalls and access rights - Views
translation - Flexible
customization for all db elements - Bulk Insert and
Quantization options for speed-up processing of big volume of data - Conditional data
migration. Data Filters. - Full UNICODE architecture support
- Data mapping
- Proactive detection of
potential data migration issues - Command line
mode.
Scheduling - Savable
sessions
4. Detection of potential database migration issues. Errors and Warnings
The database typically constrains certain relations on the data that cannot be violated. On the
customization step, a smart error checker verifies all possible Data integrity
and Referential integrity issues and highlights them, if any, before performing a migration.
By default, DBConvert tries to automatically map the database types of the source
Excel database to the closest equivalent of the target MySQL
database types. However, you can manually change the data types for the entire database globally using the
«Global mapping» or individually for each field.
Check out Smart error checker. Errors and Warnings for more
information.
5. Execution. The final stage of data migration from Excel
to
MySQL
Once you configure source and destination databases for migration in the previous steps, you can start
the actual conversion or synchronization process.
Click the «Commit» button to start
conversion. Also, here, you can monitor the migtation/ synchronization process.
Optionally save connection settings and configuration parameters into the session file to
schedule the launching of sync or migration jobs regularly.
Read more about execution stage available options.
Command line mode
Previously saved sessions can be passed as parameters to Command-Line DBConvert Client. A session keeps
Excel source and MySQL target database connection settings
with other specified options.
Example:
C:Program FilesDBConvertexcel2mysqlProexcel2mysqlPro_Cons.exe /Session:"Session_Name"
NOTE: First, you have to run the software in GUI mode
to create a session file with
initial parameters.
Built-in scheduler.
Our applications come with a built-in scheduler to run database migration and sync jobs at
specified
times. Just set the scheduled date and time to execute job sessions automatically.
Find more Information about built-in scheduler