I'm working on excel where I've few columns. I would like to make SQL insert operation from the records in sheet.
There are chances of cell to be empty and this is where I am unable to continue. I need to check:
if(cell is empty)
How can I implement it inside formula?
=CONCONTENATE("INSERT INTO TABLE VALUES"("A1,if(A2="",NULL,"'","A2","'"))
correct me if anything wrong
Best How To :
One example of a working function would be:
=CONCATENATE("INSERT INTO TABLE MyTable (Col1, Col2) VALUES ('", A2, "', ", IF(ISBLANK(B2), "NULL", CONCATENATE("'", B2, "'")), ")")
This assumes that you are inserting two values from the same Excel row, adds quotes around values to allow you to insert text strings, and then replaces any blank values with
IF() statement contains its own
CONCATENATE() to add quotes around the value if it exists (you wouldn't want quotes around the
The screenshot below shows the setup and results: