SQL from Excel

Here is a way in order to create SQL from Excel data. Suppose a table data is stored in an Excel sheet and you want to create insert query for data in a particular row. Let us imagine that there are 4 columns in Excel sheet –


  A B C D E
1 let the truth prevail  

In order to cerate the insert SQL for a table with 4 columns sufficient to accommodate these 4 values, following is the format for SQL which you need to specify in Column E –

="Insert into QUOTES values(‘"&A1&"’,’"&B1&"’,’"&C1&"’,’"&D1&"’);"

So that after pressing enter/return key, table looks like –


  A B C D E
1 let the truth prevail Insert into QUOTES values(let,the,truth,prevail);



This is quite helpful when you are having hundreds of rows in excel and you can just create SQL for all of them on fly by just dragging down the above column for rest.

Leave a Reply

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