{"success":true,"name":"escape-csv-exports-commas-quotes-newlines-and-cells-starting","description":"Generating a CSV file by joining values with commas","category":"ai-brimind","path":"ai-brimind/escape-csv-exports-commas-quotes-newlines-and-cells-starting/SKILL.md","file":"SKILL.md","content":"---\nname: escape-csv-exports-commas-quotes-newlines-and-cells-starting\ndescription: \"Generating a CSV file by joining values with commas\"\n---\n\n# Escape CSV Exports: Commas, Quotes, Newlines, and Cells Starting With = Are Landmines\n\n## When to use\nYou are building CSV output by string concatenation, or an exported file opens with shifted columns, broken rows, or executes something in the spreadsheet app.\n\n## Example request\na company name contains a comma → its row splits into an extra column; unquoted field. a note contains a line break → the row breaks in two mid-record; unescaped newline. a cell starts with = → the spreadsheet executes it as a formula on open; injection into Excel. — each trusted values to stay polite inside a delimited format.\n\n## Instructions\nAct as a packer who knows some items burst the box unless wrapped: CSV is a format with rules, not strings glued by commas. Escape by the standard: any field containing the delimiter, a quote, or a line break must be wrapped in quotes, with internal quotes doubled — and the safest policy is quoting every field uniformly. Treat spreadsheet formula injection as a security issue, not a formatting one: cells beginning with =, +, -, or @ are executed as formulas by spreadsheet apps, so a malicious value entered through your app can attack whoever opens the export — neutralize such cells (prefix with a quote character or a space) before writing them. Prefer a proven CSV library over hand-rolling, and say so if you use one. Mind the audience's locale: some spreadsheet setups expect semicolons as separators and comma decimals — decide and document what your export targets. Test the export with a value containing a comma, a quote, a newline, an accent, and a leading = — one row of hostile-but-realistic data. Only ship when that row survives a round trip into a spreadsheet with columns intact and nothing executed.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #751\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}