דלג לתוכן הראשי

ליצור קובץ CSV

שלבmake-csvfiles

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

במבט אחד​

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

קלט​

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

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו מסמכים ונתונים.

פלט​

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

הגדרות​

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

הגדרהסוגברירת מחדלתיאור
fromstring-From is the field that holds the rows; rows (find-row's list) when unset.minLength 1; maxLength 100
columnslist 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[].titlestring-Title is the heading in the file; the name when unset.maxLength 200
filenamestring-Filename names the file; it may hold {fields}. export.csv when unset.maxLength 200
bombooleantrueBOM 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.

דוגמה​

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

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

צומת שמריץ את make-csv נכנס תחת spec.nodes של Flow. תנו לו כל מזהה, ורשמו ב-next את מזהי הצמתים הבאים.

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