Skip to main content

Update a spreadsheet

Stepupdate-spreadsheetfiles

Writes new values into cells of an Excel file and saves it as a new file. Formulas, tables and the other sheets stay as they were, and a row that matches more than once is reported instead of guessed.

At a glance​

PropertyValue
Step nameupdate-spreadsheet
ResourceClusterStep (lumen.ai/v1alpha1)
Palette group, categoryfiles, tables
Credits1 credit each time it succeeds
Side effectsno
Installation must providenothing

Inputs​

PropertyValue
Needsnothing
Producesfile, fields
Works onitem one document at a time

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See Documents and data.

Outputs​

A later node references an output as {nodeId.field} in text, or nodeId.field in a condition.

OutputType
filestring
reviewFilestring
changesarray
unchangedarray
ambiguousarray
notFoundarray
refusedarray
changednumber
problemsnumber
summarystring

Settings​

Set under config: on the flow node. Text settings may contain {nodeId.field} placeholders.

SettingTypeDefaultDescription
filestring-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
newestCopybooleantrueNewestCopy 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.
changeslist of object-Changes are the cells to set.maxItems 500
changes[].sheetrequiredstring-Sheet is the worksheet the cell is on.minLength 1; maxLength 31
changes[].headerRowinteger-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[].matchmap 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[].columnstring-Column is the header (or the letter) of the column to set in the row found.maxLength 100
changes[].cellstring-Cell is an A1 reference, instead of match and column.maxLength 12
changes[].valuerequiredstring-Value is the new value; it may hold {placeholders}.maxLength 1000
changes[].typestring"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[].dateFormatstring-DateFormat is a date-text change's layout, of yyyy, yy, MM and dd.maxLength 20
changes[].allowFormulaboolean-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[].labelstring-Label says what the change is, for the list of changes (ZIM Ravenna to Ashdod 20'). Unset is the match.maxLength 200
changes[].sourcestring-Source says where the change comes from (the rate email, the carrier); the note on a marked cell repeats it.maxLength 200
changesFromstring-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
filenamestring-Filename names the new file; it may hold {fields}. Unset is the source's name.maxLength 200
markobject-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.fillstring"#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.commentbooleantrueComment adds an Excel note to each changed cell: what it was, where the change came from, the day. On unless set to false.
mark.outputstring"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

The full JSON Schema of these settings: update-spreadsheet.schema.json.

Example​

Update a supplier's balance

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

Use it in a flow​

A node that runs update-spreadsheet goes under spec.nodes of a Flow. Give it any id, and list the next node ids in next.

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"