Create insert statement in Excel

If you have a lot of data in CSV or Excel file, you may want to insert them into SQL table. In this lesson, I’ll teach you how you can do it with a formula.

The following example has four columns with data. We want to insert it into an SQL table.

Now we are going to add the following formula to cell E2 and autofill for the rest of the rows.

Instead of using single quotes and double quotes, we are going to use only double quotes. In this case, if you need to insert a string value (first_name, last_name) you can use double quotes three times. This way, we are sure that there is no conflict between quotes.

After you use autofill, it’s going to return three SQL queries.