# עדכון גיליון

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

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

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `update-spreadsheet` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | files, 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` בתנאי.

| פלט | סוג |
| --- | --- |
| `file` | string |
| `reviewFile` | string |
| `changes` | array |
| `unchanged` | array |
| `ambiguous` | array |
| `notFound` | array |
| `refused` | array |
| `changed` | number |
| `problems` | number |
| `summary` | string |

## הגדרות

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

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `file` | string |  | A path in Files, such as saved/Price lists/prices.xlsx, or a file in a Microsoft 365 connection, connection:<name>/prices.xlsx. Empty uses the spreadsheet the document carries. (maxLength 500) |
| `newestCopy` | boolean | `true` | NewestCopy reads the newest copy save-file made of File (prices (3).xlsx after prices.xlsx), so saving the approved result makes it the one the next run updates. On unless set to false. |
| `changes` | list of object |  | Changes are the cells to set. (maxItems 500) |
| `changes[].sheet` (חובה) | string |  | Sheet is the worksheet the cell is on. (minLength 1; maxLength 31) |
| `changes[].headerRow` | integer |  | HeaderRow is the row that holds the column names. Unset is the header of the sheet's table when it has one, else row 1. (minimum 1; maximum 1000) |
| `changes[].match` | map of string |  | Match finds the row: a column header to the value the row has there. Every one must hold; case and extra spaces do not count. |
| `changes[].column` | string |  | Column is the header (or the letter) of the column to set in the row found. (maxLength 100) |
| `changes[].cell` | string |  | Cell is an A1 reference, instead of match and column. (maxLength 12) |
| `changes[].value` (חובה) | string |  | Value is the new value; it may hold `{placeholders}`. (maxLength 1000) |
| `changes[].type` | string | `"auto"` | Type is how the value is written: auto (a number when it reads as one, else text), number, text, or date-text (a date written as text in dateFormat, as many price lists keep validity dates). (one of auto, number, text, date-text) |
| `changes[].dateFormat` | string |  | DateFormat is a date-text change's layout, of yyyy, yy, MM and dd. (maxLength 20) |
| `changes[].allowFormula` | boolean |  | AllowFormula lets the change write over a formula. Only a change written in the step's settings can; a change from a field never does. |
| `changes[].label` | string |  | Label says what the change is, for the list of changes (ZIM Ravenna to Ashdod 20'). Unset is the match. (maxLength 200) |
| `changes[].source` | string |  | Source says where the change comes from (the rate email, the carrier); the note on a marked cell repeats it. (maxLength 200) |
| `changesFrom` | string |  | ChangesFrom names a field that holds a list of changes, as an AI step gives them: `{extract.changes}`. Its changes come after Changes. (maxLength 100) |
| `filename` | string |  | Filename names the new file; it may hold `{fields}`. Unset is the source's name. (maxLength 200) |
| `mark` | object |  | Mark says how the changed cells are marked for the person who reviews the update. Unset writes a second, marked copy, the review copy, and leaves the updated workbook clean. |
| `mark.fill` | string | `"#FFF2CC"` | Fill is the cell's background, as a hex color. Only the fill changes: the cell keeps its number format, font and borders. (pattern \`^#?\[0-9A-Fa-f\]{6}$\`) |
| `mark.comment` | boolean | `true` | Comment adds an Excel note to each changed cell: what it was, where the change came from, the day. On unless set to false. |
| `mark.output` | string | `"review"` | Output is where the marks go: review (a second, marked copy for reading; the updated workbook stays clean), both (the updated workbook is marked too, and there is no second file) or none. (one of review, both, none) |

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

## דוגמה

```yaml title="config"
changes:
- column: Balance
 match:
 Supplier: ספק לדוגמה ב
 sheet: Sheet1
 type: number
 value: "990"
```

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

צומת שמריץ את `update-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: update-spreadsheet-example
  namespace: tenant-acme
spec:
  displayName: "Update a spreadsheet"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [update-spreadsheet]
  nodes:
    - id: update-spreadsheet
      stepRef: {name: update-spreadsheet}
      config:
        changes:
        - column: Balance
          match:
            Supplier: ספק לדוגמה ב
          sheet: Sheet1
          type: number
          value: "990"
```
