# מיזוג שורות לגיליון

> מעדכן חוברת עבודה מגיליון מקור אחד או יותר בלי בינה מלאכותית. שורות מותאמות לפי עמודת מפתח, מפתחות חדשים נוספים כשורות, וכל מה שלא ברור מדווח כבעיה במקום לנחש.

Source: https://docs.go-lumen.ai/he/reference/steps/merge-rows

## במבט אחד

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

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | כלום |
| **מפיק** | `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` בתנאי.

| פלט | סוג |
| --- | --- |
| `file` | string |
| `changes` | array |
| `added` | array |
| `problems` | array |
| `alerts` | array |
| `conflicts` | array |
| `changed` | number |
| `problemCount` | number |
| `needsReview` | boolean |
| `summary` | string |

## הגדרות

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

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `target` (חובה) | object |  | Workbook to update |
| `target.file` | string |  | A path in Files (saved/Reports/report.xlsx) or the name of a file of the run. Use either this or the newest in a folder. (maxLength 500) |
| `target.newestByDateIn` | string |  | A folder in Files, such as saved/Reports/. (maxLength 500) |
| `targetSheet` | string |  | TargetSheet is the target's worksheet; unset is the first. (maxLength 31) |
| `targetHeader` | object |  | Header of the workbook |
| `targetHeader.row` | integer |  | 0 finds the row by the text of its first cell. (minimum 0; maximum 1000) |
| `targetHeader.firstCell` | string |  | FirstCell is the text of the header row's first cell (column A). (maxLength 100) |
| `key` (חובה) | object |  | Key |
| `key.target` (חובה) | string |  | Target is the key column of the target: a header or a letter. (minLength 1; maxLength 100) |
| `key.source` (חובה) | string |  | Source is the key column of every source: a header or a letter. (minLength 1; maxLength 100) |
| `key.split` | string |  | Empty is a comma. (maxLength 5) |
| `sources` (חובה) | list of object |  | Sources (minItems 1; maxItems 10) |
| `sources[].match` (חובה) | object |  | Which file |
| `sources[].match.file` (חובה) | string |  | A pattern such as \*SHO\*. (minLength 1; maxLength 200) |
| `sources[].sheet` | string |  | Sheet is the source's worksheet; unset is the first. (maxLength 31) |
| `sources[].header` | object |  | Header |
| `sources[].header.row` | integer |  | 0 finds the row by the text of its first cell. (minimum 0; maximum 1000) |
| `sources[].header.firstCell` | string |  | FirstCell is the text of the header row's first cell (column A). (maxLength 100) |
| `sources[].map` (חובה) | map of string |  | Map is source column to target column, each a header (or a letter). |
| `appendNew` | boolean | `true` | AppendNew adds a source row whose keys the target does not have. On unless set to false. |
| `onMissingHeader` | string | `"report"` | OnMissingHeader says what a mapped header that is not in a file does: report skips that column and says so, fail stops the step. (one of report, fail) |
| `sheetName` | string |  | SheetName renames the target's worksheet; it may hold `{today:dd.MM.yyyy}`. (maxLength 60) |
| `filename` | string |  | Filename names the new file; it may hold `{today:dd.MM.yyyy}` and `{fields}`. (maxLength 200) |
| `lang` | string |  | Lang is the summary's language, he or en; empty follows the email. (one of , he, en) |

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

## דוגמה

```yaml title="config"
filename: '{today:dd.MM.yyyy}.xlsx'
key:
  source: Order No
  target: Order No
sheetName: '{today:dd.MM.yyyy}'
sources:
- header:
    firstCell: Order No
  map:
    Delivery Date: Delivery Date
    Ship Date: Ship Date
  match:
    file: '*export*'
target:
  file: orders-report.xlsx
targetHeader:
  firstCell: Order No
```

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

צומת שמריץ את `merge-rows` נכנס תחת `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: merge-rows-example
  namespace: tenant-acme
spec:
  displayName: "Merge rows into a spreadsheet"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [merge-rows]
  nodes:
    - id: merge-rows
      stepRef: {name: merge-rows}
      config:
        filename: '{today:dd.MM.yyyy}.xlsx'
        key:
          source: Order No
          target: Order No
        sheetName: '{today:dd.MM.yyyy}'
        sources:
        - header:
            firstCell: Order No
          map:
            Delivery Date: Delivery Date
            Ship Date: Ship Date
          match:
            file: '*export*'
        target:
          file: orders-report.xlsx
        targetHeader:
          firstCell: Order No
```
