If you want to import excel Table into SQL Database. You are at right place. Most of the time we required to import Excel Data into SQL (Like MySQL Database), and conversion is not easy task.
We have prepared Customized fuction for you (called User Defined Function (UDP).
This function wraps selected range Row into SQL comma seperated format. You just have to Copy Output into your SQL Query.
Exce Function is As follows –
=SQLFormat(#REF)
VBA Code to Activate this function –
Public Function SQLFormat(b As Range) As String
Dim a As String
Dim bb As Range
a = ""
For Each bb In b
If (a = "") Then
a = "('" & Replace(bb, "'", "")
Else
a = a & "','" & Replace(bb, "'", "")
End If
Next bb
a = a & "'),"
SQLFormat = a
End Function
Steps to Activate this function as follows –
Open Required Excel >> Go to VBA Editor (Alt+F11) >> Insert “Module” > Copy above code in the module.
Save as >> File in xlsm or xlsb format.
Formula use case and Output –

Let’s Try and Enjoy !
[Note – This Formual works only in the Excel file Where Above VBA Code is Inserted.]