Text Tools

List to comma separated.

Paste a column from Excel or Google Sheets, or any list with one item per line, and get a comma separated string. Add quotes, wrap it as a SQL IN clause or an array, or go the other way and split a comma list into lines.

Advertisement

Input

Pasting a spreadsheet column gives one value per line.

Result

Paste a list to convert it.

About this list to comma separated converter

Spreadsheet columns, ID lists and search results usually come as one value per line, but SQL, code, tag fields and bulk-entry forms want them on a single line with separators. This tool does that conversion and the quoting that usually goes with it.

Worked examples

Input lines Toronto, Ottawa, Montreal give:

Toronto, Ottawa, Montreal                       (no quotes)
'Toronto', 'Ottawa', 'Montreal'                 (single quotes)
IN ('Toronto', 'Ottawa', 'Montreal')            (single quotes + SQL IN)
["Toronto", "Ottawa", "Montreal"]               (double quotes + array)

Quoting rules

Separator

The default is a comma and a space. Use , for compact output, | or ; for other formats, or \n as the separator to keep one item per line. Choosing "Comma separated to lines" reverses the process and strips matching quotes around each item.

Limits

This is a text converter, not a SQL tool: very large IN lists may exceed your database's limits (Oracle allows 1,000 items in an IN list), and values with line breaks inside them are not preserved. Input is limited to 5 MB and processed in your browser.

FAQ

How do I convert an Excel column to a comma separated list?

Select the column in Excel or Google Sheets, copy it, paste it above and copy the result. A copied column arrives as one value per line, which is what this tool expects.

How do I make a SQL IN clause from a list?

Set Quotes to Single and Wrap to SQL: IN ( ... ). Numbers can stay unquoted. Check the list size against your database's limit.

Can I turn a comma separated list back into lines?

Yes. Switch Direction to "Comma separated to lines", and set the separator if it is not a comma.

Advertisement
Advertisement
Listening…