# ליצור קובץ CSV

> הופך רשימת שורות, למשל השורות שנמצאו בגיליון, לקובץ CSV שנפתח באקסל.

Source: https://docs.go-lumen.ai/he/reference/steps/make-csv

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `make-csv` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | files, tables |
| **קרדיטים** | **0.5** קרדיטים בכל פעם שהוא מצליח |
| **השפעה חיצונית** | לא |
| **ההתקנה צריכה לספק** | כלום |

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | `fields` |
| **מפיק** | `file` |
| **עובד על** | item: מסמך אחד בכל פעם |

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו [מסמכים ונתונים](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#documents-and-data).

## פלט

אין פלטים בשם. הצמתים הבאים עדיין רואים את כל מה שהופק קודם במסלול, והשלב מעביר את המסמכים הלאה כמו שהם.

## הגדרות

מגדירים תחת `config:` בצומת של התהליך. הגדרות טקסט יכולות להכיל מצייני מקום כמו `{nodeId.field}`.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `from` | string |  | From is the field that holds the rows; rows (find-row's list) when unset. (minLength 1; maxLength 100) |
| `columns` | list of object |  | Columns are the columns to write, in order, with their headings. When unset every key the rows have is written, in the order they first appear (rowId first when the rows have one). (maxItems 200) |
| `columns[].name` (חובה) | string |  | Name is the key in each row (a sheet column's name). (minLength 1) |
| `columns[].title` | string |  | Title is the heading in the file; the name when unset. (maxLength 200) |
| `filename` | string |  | Filename names the file; it may hold `{fields}`. export.csv when unset. (maxLength 200) |
| `bom` | boolean | `true` | BOM starts the file with a UTF-8 byte order mark, which Excel needs to read Hebrew; on unless set to false. |

ה-JSON Schema המלא של ההגדרות: [make-csv.schema.json](https://docs.go-lumen.ai/schemas/steps/make-csv.schema.json).

## דוגמה

```yaml title="config"
columns:
- name: name
  title: Supplier
- name: city
  title: City
- name: status
  title: Status
filename: suppliers.csv
from: rows
```

## שימוש בתהליך

צומת שמריץ את `make-csv` נכנס תחת `spec.nodes` של [Flow](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#the-flow-as-yaml). תנו לו כל מזהה, ורשמו ב-next את מזהי הצמתים הבאים.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
  name: my-webhook
  namespace: tenant-acme
spec:
  classRef: {name: webhook}
  config: {}
---
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: make-csv-example
  namespace: tenant-acme
spec:
  displayName: "Make a CSV file"
  triggers:
    - id: start
      ref: {name: webhook-received}
      connectorRef: {name: my-webhook}
      next: [make-csv]
  nodes:
    - id: make-csv
      stepRef: {name: make-csv}
      config:
        columns:
        - name: name
          title: Supplier
        - name: city
          title: City
        - name: status
          title: Status
        filename: suppliers.csv
        from: rows
```
