{
  "slug": "csv-collapse-rows",
  "name": "gizza-ai/csv-collapse-rows",
  "version": "0.1.0",
  "title": "CSV Collapse Rows — Group and Join a Column — gizza.ai",
  "description": "Group CSV rows by key columns and join another column into one delimited cell, with dedupe, sorting, and browser-local processing.",
  "tags": [
    "csv group concat",
    "csv collapse rows",
    "csv group by",
    "combine rows csv",
    "csv string agg",
    "csv listagg",
    "merge duplicate rows csv",
    "csv aggregate column",
    "join column values csv"
  ],
  "category": "data",
  "urls": {
    "page": "https://gizza.ai/tools/csv-collapse-rows/",
    "markdown": "https://gizza.ai/tools/csv-collapse-rows/index.md",
    "descriptor": "https://gizza.ai/tools/csv-collapse-rows/tool.json",
    "deep_link_example": "https://gizza.ai/tools/csv-collapse-rows/?data=region%2Cproduct%0AEast%2CApple%0AWest%2CBanana%0AEast%2CCherry%0AEast%2CApple&key_columns=region&collapse_column=product&separator=%2C%20&dedupe=true&skip_empty=true&sort_values=none&delimiter=comma&has_header=true"
  },
  "cli": "gizza tool csv-collapse-rows \"region,product\nEast,Apple\nWest,Banana\nEast,Cherry\nEast,Apple\" 'key_columns=region' 'collapse_column=product'",
  "tool": {
    "description": "Group CSV rows by one or more key columns and collapse a chosen column's values from every row in the group into a single delimited cell — the CSV equivalent of SQL GROUP_CONCAT. `key_columns` is a comma-separated list of header names/indices; `collapse_column` is the column to collapse. Optionally dedupe (DISTINCT), sort the values, skip blanks, and pick the field delimiter. Output has one row per group (first-seen order): the key columns then the collapsed column. Requires a header row.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "collapse_column": {
          "description": "The column whose values are collapsed into one delimited cell (header name or 1-based index).",
          "type": "string"
        },
        "data": {
          "description": "The CSV text (first row must be a header).",
          "type": "string"
        },
        "dedupe": {
          "default": false,
          "description": "Drop duplicate values within each group (like SQL DISTINCT).",
          "type": "boolean"
        },
        "delimiter": {
          "default": "comma",
          "description": "CSV field delimiter for input and output.",
          "enum": [
            "comma",
            "tab",
            "semicolon",
            "pipe"
          ],
          "type": "string"
        },
        "has_header": {
          "default": true,
          "description": "First row is a header. When on, columns may be referenced by name or 1-based index; when off, use 1-based indices and output columns are labelled col_1, col_2, …",
          "type": "boolean"
        },
        "key_columns": {
          "description": "Column(s) to group by — comma-separated header names or 1-based indices.",
          "type": "string"
        },
        "separator": {
          "default": ", ",
          "description": "String inserted between collapsed values. Default ', '.",
          "type": "string"
        },
        "skip_empty": {
          "default": true,
          "description": "Ignore blank cells in the collapse column.",
          "type": "boolean"
        },
        "sort_values": {
          "default": "none",
          "description": "Order collapsed values within each cell: none (first-seen), asc, or desc.",
          "enum": [
            "none",
            "asc",
            "desc"
          ],
          "type": "string"
        }
      },
      "required": [
        "data",
        "key_columns",
        "collapse_column"
      ],
      "type": "object"
    }
  }
}