Created
July 26, 2013 15:30
-
-
Save JamoCA/6089803 to your computer and use it in GitHub Desktop.
AutoHotKey script to convert clipboard columnar data (from Excel or text file) to SQL-compatible comma-delimited list (adds single quotes if data consists of non-numeric values) (Windows+C)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#c:: ;Window+C Convert Columnar Data to SQL-Compatible List | |
StringReplace,clipboard,clipboard,`n,`,,All | |
StringReplace,clipboard,clipboard,`r,,All | |
StringGetPos, pos, clipboard, ID`, ; remove "ID" if first item in the list (Access). | |
if pos = 0 | |
StringRight, clipboard, clipboard, StrLen(clipboard)-3 | |
testString = %clipboard% | |
StringReplace,testString,testString,`,,,All | |
testString := testString * 1 | |
if (testString is integer) { | |
} else { | |
StringReplace,clipboard,clipboard,`,,'`,',All | |
clipboard = '%clipboard%' | |
} | |
Send,^v | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this what you are looking for?