You have a column of customer IDs or product codes in a spreadsheet. You need them in a SQL IN() clause. Manually adding quotes and commas to 200 values takes 20 minutes and introduces typos. There's a faster way that takes 15 seconds.
The Problem: From Spreadsheet Column to SQL IN()
You have a column in Excel or Google Sheets:
1234 5678 9101 1121
You need it as:
IN ('1234', '5678', '9101', '1121')Each value needs a leading single quote, a trailing single quote and comma. Then the entire list needs IN ( at the start and the last comma removed.
Method 1: Browser Prefix/Suffix Tool (Fastest)
- Copy your column from Excel or Sheets.
- Paste into a prefix/suffix tool.
- Set Prefix to
'(single quote). - Set Suffix to
',(single quote + comma). - Enable Skip empty lines to avoid blank entries.
- Copy the result and wrap it:
IN (at the start, remove the trailing comma, add).
Total time: about 15 seconds for any size list.
Method 2: Excel Formula
In a helper column, use: =CONCATENATE("'",A1,"',") or ="'"&A1&"',"
Then copy the helper column, paste as values into a text editor, remove the trailing comma from the last entry, and wrap with IN(). This works but requires 5+ steps.
For recurring tasks with changing data: Excel's approach keeps the formula live. For one-off tasks: the prefix/suffix tool is faster.
Method 3: Google Sheets TEXTJOIN
=TEXTJOIN("','", TRUE, A1:A200)
This joins all values with ',' between them. Add a leading and trailing quote manually: ='"'&TEXTJOIN("','",TRUE,A1:A200)&"'"
Result: '1234','5678','9101' — paste directly into IN(). This method scales cleanly and requires no helper column.
For Numeric IDs: Skip the Quotes
If your column contains integer IDs (not strings), you don't need quotes: IN (1234, 5678, 9101). Use a prefix/suffix tool with an empty prefix, comma-only suffix, and wrap manually. Or use TEXTJOIN with just a comma: =TEXTJOIN(",", TRUE, A1:A200).
Try the Free Tool
Add prefix and suffix to each line instantly — perfect for SQL IN() lists, arrays, and quoted lists.
Build Your SQL List →Frequently Asked Questions
How do I convert an Excel column to a SQL IN() list?
Copy your column, paste into a prefix/suffix tool, set prefix to ' and suffix to ',, then wrap the result in IN( ... ) removing the trailing comma. Alternatively use the Excel formula =CONCATENATE("'",A1,"',") in a helper column.
How do I use TEXTJOIN to create a SQL list in Google Sheets?
Use ='&TEXTJOIN("','",TRUE,A1:A100)&' to join all values with single quotes and commas. Paste the result inside IN( ... ) in your query.
Should SQL IN() values be quoted?
String values need quotes: IN ('value1', 'value2'). Integer or numeric values don't: IN (1, 2, 3). Using quotes around numbers still works in most databases but is unnecessary and slightly less efficient.
How do I handle a large list in SQL IN()?
Most databases handle IN() lists with hundreds or thousands of values, but performance degrades at scale. For very large lists (10,000+ values), consider loading the values into a temporary table and using a JOIN instead of IN(). For moderate lists (under 1,000), IN() is fine.