Microsoft Excel to MySQL: the process of migrating data from both databases

Technology

Microsoft Excel, being the traditional choice for spreadsheets, is the most used tool to arrange and manage data. Its ability to read and write large sets of data is unmatched by any other tool of this kind. Companies around the world use it to manage their client data and records. The tool provides easily accessible datasets and a bunch of formulas to manage them. 

Although it can handle anything, Microsoft Excel is not suitable when the data exceeds certain limits. When it comes to managing thousands of sheets of data having millions of rows or columns, you will have to find other alternatives. The reason for looking for alternatives is that managing large sets of data on Excel is time-consuming and source-intensive. This might not be suitable for companies or businesses that have limited resources and manpower.

In such cases, you will have to opt for an open-source database and MySQL is the first one that comes to mind. The commands or queries using MySQL can run thousands of columns or rows deep and can find data that relates them to one another. You can filter, manipulate, update, or even combine data using simple internal as well as external queries.

Here are the different strategies you can use to migrate data from MS Excel to MySQL.

Using the LOAD DATA option

This is the simplest method to transfer data from MS Excel to MySQL databases. The approach to migration consists of the following steps:

  • Open the file in MS Excel
  • Save the file as a CSV file
  • Open MySQL database
  • Create empty tables
  • Import the data using the LOAD DATA command

That’s it, all your data from the CSV file will be loaded into the MySQL database.

Using a third-party tool

Certain tools like “MS Excel to MySQL” by Intelligent Converters have been created that can help you easily transport data from a CSV file to MySQL. The tool comes in handy when, for any reason, you are unable to use the LOAD DATA option discussed above. 

With this tool, you can use commands to export and import data and save a lot of time. Not only that but you can also schedule when you want to do the conversion and how you want to do it.

Intelligent types mapping

Unlike MS Excel in which INTEGER and DOUBLE are undefined, MySQL supports every data type including INTEGER and DOUBLE. When converting a CSV file into a MySQL database, the INTEGER and DOUBLE might get mixed and the resulting file can be corrupted or inaccurate. To remedy this, the converter scans every column and row and divides the data based on their data types.

The values and data types used by the converter resemble the following.

10.000000000000000e+000

-3.000000000000000e+001

0.2100000000000000e+002

Different statistics corresponding to different columns are scanned thoroughly and the converter updates the values based on their data types. The resulting database will be an accurate representation of the original CSV file. This technique is called Intelligent Types Mapping.