# לקרוא גיליון

> קורא את השורות של קובץ אקסל או CSV מצורף, ומשתמש בשורה הראשונה כשמות העמודות. כדי למצוא שורות, תנו where כשם עמודה וטקסט (חלק מהתא מספיק; * כשם עמודה מחפש בכל העמודות, ומספר נמצא עם אפסים בהתחלה או בלעדיהם, כך ש-00069841 מוצא 69841).

Source: https://docs.go-lumen.ai/he/reference/steps/read-spreadsheet

## במבט אחד

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

## קלט

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

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

## פלט

צומת מאוחר יותר מפנה לפלט כ-`{nodeId.field}` בטקסט, או כ-`nodeId.field` בתנאי.

| פלט | סוג |
| --- | --- |
| `rows` | array |
| `count` | number |
| `columns` | array |
| `truncated` | boolean |
| `headerRow` | number |

## הגדרות

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

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `sheet` | string |  | Sheet is the worksheet to read (an.xlsx; a.csv has one). Unset is the first. (maxLength 31) |
| `headerRow` | integer | `1` | HeaderRow is the row that holds the column names. Unset is 1. (minimum 1; maximum 1000) |
| `maxRows` | integer | `1000` | MaxRows is the most rows brought; more is cut off and truncated says so. Unset is 1000. (minimum 1; maximum 10000) |
| `file` | string |  | A path in Files, such as saved/Price lists/prices.xlsx, a file in a Microsoft 365 connection, connection:<name>/prices.xlsx, or the name of one of the document's files (an email's attachment). Empty reads the first spreadsheet the document carries. (maxLength 500) |
| `newestCopy` | boolean | `true` | NewestCopy reads the newest copy save-file made of File. On unless set to false. |
| `findHeader` | boolean |  | FindHeader looks for the column names in the first rows (the row with the most cells filled) instead of HeaderRow: a carrier's export has a few title rows first, at a place that changes. |
| `columns` | list of string |  | Columns keeps only these columns in each row. An agent reading a wide sheet reads it again on every turn; the columns it needs are a fraction of it. (maxItems 50) |
| `where` | map of string |  | Column name and the text it holds (a part of the cell is enough; PIRAEUS|RAVENNA means either). Use \* as the column to search every column. A number ignores leading zeros: 00069841 finds 69841. |

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

## דוגמה

```yaml title="config"
headerRow: 1
```

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

צומת שמריץ את `read-spreadsheet` נכנס תחת `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: Flow
metadata:
  name: read-spreadsheet-example
  namespace: tenant-acme
spec:
  displayName: "Read a spreadsheet"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [read-spreadsheet]
  nodes:
    - id: read-spreadsheet
      stepRef: {name: read-spreadsheet}
      config:
        headerRow: 1
```
