Create SQL Server Tables from Excel Data – Free Tool

So I’ve got some time to come up for air and share a tool I’ve pulled together to help me in my client engagements.

The work I do often requires me to database existing Excel processes. That means taking existing Excel tables and moving their structure (and sometimes their data values) to SQL Server.

If you’ve had to do that before, you’ll know it’s a pain to do.

Today I’d like to share a tool I created to help me create SQL Server tables from existing Excel data.

First of all, you can download this tool here.

It’s wide open so if you want to look at the code and make it better, feel free.

The tool itself is fairly easy to use.

1. Paste your data into the first sheet.

2. Press the Capture Data button

This will activate a new sheet showing the captured fields converted to valid SQL naming conventions and valid SQL Server data types. The tool will do its best to predict the right data type, as well as avoid common errors like invalid characters and duplicate field names.

 3. In this new sheet, you can edit the suggested field names and data types. You can also select your Primary keys and add any Default values you want.

4. Press the Generate SQL button.

 

A new dialog box will activate.

5. Enter a name for your new table and then click the Generate SQL button.

6. At this point, you will see the CREATE TABLE SQL statement.

 

If all you need is the structure of the Excel table, you can simply this code and use it in SQL Server to create the table.

If you’re an advanced user with CREATE rights on the server, you can use the Advanced options.

7. If you want the tool to create the table and send the data as well, enter the server connection string.

8. Select the appropriate options

9. Click the Execute button.

Here’s a quick YouTube video showing this tool in action.

This tool has certainly saved me tons of time. Hopefully, some of you find this useful too.

Until next time.

5 thoughts on “Create SQL Server Tables from Excel Data – Free Tool

Leave a Reply

Your email address will not be published. Required fields are marked *