CRITICAL — Before starting, you MUST first use the Read tool to read ../lark-shared/SKILL.md, which contains authentication and permission handling.
Scenario → Command quick reference
Select the row according to the current action; the next step MUST Read that row's reference, and commands must not be executed before the read is complete. Read only the documents that are hit; for cross-cutting actions such as formulas/styles, then read the corresponding specifications, and enumerating the directory in place of Read is prohibited.
| What you want to do | ✅ Correct approach | Read before acting (Read first, then act) |
|---|---|---|
| Read data | +csv-get(pure values/CSV),+cells-get(formulas/styles/comments) |
Read references/lark-sheets-read-data.md |
| Write data | +csv-put(unambiguous pure text without types),+table-put(typed; quantities/real dates; labels/IDs/leading zeros/text numbers use object, bare csv-put is prohibited),+cells-set(formulas/rich writes),+cells-set-style(styles),+cells-set-image(cell images) |
Read references/lark-sheets-write-cells.md |
| Format inheritance (new columns/new rows) | For physically inserting rows / inserting columns use +dim-insert --inherit-style before|after; for extending writes into existing blank areas use +range-copy --paste-type formats to lay out styles first, then write values |
Read references/lark-sheets-range-operations.md; after inserting rows or columns read references/lark-sheets-sheet-structure.md |
| Workbook operations | +workbook-create、+workbook-info、+workbook-import、+sheet-copy、+revision-get、+workbook-export |
Read references/lark-sheets-workbook.md |
| Row/column operations | For sorting use +range-sort to atomically move entire rows; for merging / unmerging use +cells-merge / +cells-unmerge; only for clearing content use +cells-clear; for sizing use +cols-resize / +rows-resize |
Read references/lark-sheets-range-operations.md; for structural layout read references/lark-sheets-sheet-structure.md |
| Beautification and finishing | +styles-put |
Read references/lark-sheets-styles-put.md |
| Subsheet structure | +sheet-info、+dim-insert; for deleting entire rows / columns use +dim-delete, clear cannot be used as a substitute |
Read references/lark-sheets-sheet-structure.md |
| Draw charts / visualization / bar charts / line charts / pie charts / trends / proportions | For a single chart use +chart-create-basic, for multiple charts use the flat-input +batch-chart-create; to change an existing chart's data source use +chart-data-update, for configuration use +chart-config-update; only for single series / single data points / advanced fields that semantic shortcuts cannot express use +chart-create / +chart-update, and submit only the necessary partial properties. Before acting, first assert each chart's type, horizontal axis field, grouping field, and target sheet count, and after drawing use +chart-list to check item by item; after migrating images into real charts, delete and recheck the original floating images |
Read references/lark-sheets-chart.md; for pivot / group summaries also read references/lark-sheets-pivot-table.md |
| Group summary / pivot | +pivot-create |
Read references/lark-sheets-pivot-table.md |
| Filter / show only rows meeting the conditions | +filter-create |
Read references/lark-sheets-filter.md |
| Find / replace text | +cells-search、+cells-replace |
Read references/lark-sheets-search-replace.md |
| Conditional formatting / conditional highlighting / data bars / color scales | For coloring that changes with the data use +cond-format-create; fixed coloring is only used for static coloring explicitly requested by the user |
Read references/lark-sheets-conditional-format.md |
| Illustration: freely placed decorations | +float-image-create |
Read references/lark-sheets-float-image.md |
| Sparklines / in-cell trendlines | +sparkline-create |
Read references/lark-sheets-sparkline.md |
| Batch clear multiple ranges | +cells-batch-clear |
Read references/lark-sheets-batch-update.md(high-risk) |
| Review edit changes / get differences between versions | +changeset-get |
Read references/lark-sheets-changeset.md |
| Save multiple filter states / named filter views | +filter-view-create; views and +filter-create are independent of each other and can coexist in the same subtable |
Read references/lark-sheets-filter-view.md |
| Check edit history / roll back to a historical version | +history-list fetch version,+history-revert(high-risk, asynchronous) after rolling back use +history-revert-status to poll |
Read references/lark-sheets-history.md |
⚠️ Amounts / percentages / ratios / counts and real dates involved in calculations should be written as numbers (percentages passed as
0.4+number_format); date labels, IDs, leading zeros, ID card / document numbers should be written as text.--rangewrite onlyA1:B2, and pass--sheet-id/--sheet-name。
Feishu Sheets Editing Guidelines
- Minimal changes: when the user has not explicitly asked to delete / rename / hide, do not touch any existing Sheet; fill in only blank cells, and do not change values / structure / formatting that were not requested.
- Target subtable and read-back assertions: first confirm the actual last row and target range; when no subtable is named, select only from the visible grid candidates of
resource_type=sheet && is_hidden=false, and use it automatically only if it is unique; if there are multiple, do not guess by index. When "all / every sheet" is involved (cross-sheet aggregation, batch cleaning, merging multiple subtables), first+workbook-infolist them all before processing one by one, do not just do the first few. After writing, use+csv-get/+cells-get/+<对象>-listto verify the first, middle, last, and user-named items—returningokonly means the request succeeded. Before writing back pure CSV, removeannotated_csvof[row=N]prefix,cells-gethandle style fields and values separately, formulas must be read backformula。Styles must also be read back: for anything with borders / fill color / font color / number format / row height and column width / freeze written, at the end use+cells-get --include styleor+sheet-infoto spot-check the first, middle, and last cells of the target range to confirm the attributes are actually there—a write returningokdoes not mean the style landed; resend the whole thing for anything missing (styles are an idempotent stamp, resending has no side effects). - Formula closed loop: derivable values should be written as cell formulas, not replaced by static values—using Python to calculate the value and then write it into the cell delivers a dead sheet that does not recalculate when inputs change; Python is only for derivation and verification, and what lands in the cell must be a formula referencing other cells. Before writing, confirm field semantics, threshold boundaries (above/at least=
>=, exceeding/greater than=>), units/time zone, and the complete source range, and select the first, middle, last, empty values, boundaries, and one manually calculable record as sentinels; after writing, check+formula-verify --exit-on-errorsegment by segment; only when each segment'sstatus='success'and the sentinel values are correct is it complete (exception for AI formulas: asynchronous calculation, instead use+formula-verify --ai-onlyto do one asynchronous status check over the entire written range, do not use+cells-getto poll for results; afterfailedis cleared to zero, it can be delivered and explained even if there are still pending items); if trial and error still fail 3 times, you may downgrade to static values, and the delivery note must state "static value + failure reason + does not update with source data". - Fully inherit styles: when adding rows or columns, do not read only values and write only values—the original table's font, alignment, fill color (including alternating odd/even rows), and four borders must all continue into the new range.Physical insertion of rows / columnsUse
+dim-insert --inherit-style before|after(native inheritance, more reliable than backfilling);Extend into an existing blank area(e.g., adding new columns to the right of the data) use+range-copy --paste-type formatsto lay out the style first and then write the values; only for irregular styles that neither can express, use+cells-get --include styleto read the source area style and write it back along with the values. Whichever path is taken, after insertion also separately check row heights and column widths (row heights are not inherited with styles; before inserting a row and filling long text, supplement+rows-resize), merges and cross-column headers and fill them in. Seereferences/lark-sheets-write-cells.md。 - Atomic operations: for sorting use
+range-sort,--rangeto cover the full record width; write only the sort column into--sort-keys; to delete records use+dim-delete; to clear content / format use+cells-clear; it is forbidden to read values and then use+csv-putoverwriting to simulate sorting / deletion. Use high-risk+batch-update。 - Coloring triage: for highlights / red marks that should be automatically recalculated after data changes, use conditional formatting; for fixed annotations with determined results, use static styles; for decorative beautification, follow the visual specification. For the color fields on both paths, use the same criterion: in the user's Chinese context, "标红 / 染色 / 标记" refers tocell background color, and only "文字红 / 字体红 / 把字变红" uses font color; by default, when there is no explanation, choose background color. After creating conditional formatting, first
+cond-format-listto verify the rule and range, then+cond-format-result-getto spot-check the hit styles of sentinel cells. - Verifiable deliverables: the sheet names and counts, headers, titles, legends, file names, and definitions named by the user are preserved verbatim; every "completed" item in the reply can be traced to the deliverable, and gaps are declared item by item.
- Replacement and addition: after batch replacement / deletion, search to confirm there is no residue; newly added columns must have headers, with units / definitions placed separately and not occupying original headers or data cells.
- Do not fabricate: out-of-table data must have a verifiable source, and do not use common sense or name inference to fabricate companies, standard values, market quotes, or regulatory parameters;if there is no source, leave it blank—numbers filled in from memory are likely not to match the real values and are worse than leaving blanks. In the delivery notes, list blank cells item by item with their cell addresses and the missing source, and do not just write "some data is missing".
🤖 For text-based NLP tasks, prefer AI formulas; do not default to falling back to manual / Python: as long as you perform on text columnstranslation / sentiment / classification labeling / information extraction / summarization / polishingand other NLP, in Feishu online spreadsheets prefer native
=AI(prompt, range)to spread column by column (the syntax is the same as ordinary formulas, seereferences/lark-sheets-formula-translation.md); once written into the sheet, it calculates automatically row by row, which is easier than reading item by item → manual judgment → writing back / calling a model in Python and then writing static values.The criterion is "row-by-row independent": if each target cell depends only on the input in the same row, it is row-by-row independent,and data volume (even 10,000+), batching, and judgment complexity do not change this determination—For large data volumes, AI formulas are still the first choice; when batching, only change the batch size for formula laying (when there are many rows, process serially in batches; as a reference, a few hundred to one thousand rows per batch). Do not switch to "generate semantic results with Python or a rule-based script and then write them back statically"; Python can only be used for cleaning / row-number mapping / constructing formula batches, and must not read source text to generate target semantic values. Only cross-row tasks where a single result depends on multiple rows of input take the non-formula route. AI formulas are computed asynchronously; after writing, first check the seed cell / first cellonce+cells-get --include formulaverify the text, thenthe first verification entry point must be+formula-verify --ai-only --range <整个写入区间>, and it is forbidden to use+cells-getto poll for calculation results; the criterion isai_formula_failed_count == 0(--rangeis only passed through to the backend and does not guarantee a narrowed summary scope; locate and verify this interval according to the returned cell, and do not compare the total against the expected number of rows), and once satisfied it can be delivered even if there are still pending items, and inform the user that "the AI formula is still running in the background".
Process: understand the structure → (if not specified by name, first locate by visible_grid selection) → read data → write with native tools → read back and verify according to the items specified by the user → deliver online. For tasks that change the table length or layout, such as organizing / beautifying / adding summary rows, freeze the header row at the end (do not change it if the original table already has a freeze setting). xlsx acceptance is only run when handling a local xlsx, or when the user specifies a local xlsx / download / print.
References
reference is divided into two groups: first readGeneral methods and specifications(style / formula rules that cut across all tasks), then enter by operation objecttool referenceto look up the specific shortcut. For editing tasks, be sure to go through the general methods and specifications first; together with the "Feishu Sheets editing guidelines" above, they apply to all tool references.
General methods and specifications (read first, cut across all tasks, does not include specific shortcuts)
| Reference | Description |
|---|---|
| Feishu Sheets style and color specifications | Feishu Sheets style and color specifications: value standards for the color, font size, alignment, borders, number format, etc. of the header / data area / summary row, as well as the decision process and style points for typical scenarios such as beautifying the layout of a newly created sheet from scratch, adding a summary row, inheriting the original table style when appending rows or columns, and beautifying an existing area. For details of tool call parameters, please refer to the corresponding lark-sheets-write-cells / lark-sheets-range-operations / lark-sheets-batch-update. For conditional formatting (highlighting, marking in red, data bars, color scales), please use lark-sheets-conditional-format. |
| Feishu Sheets formula generation rules | Migration and generation rules from Excel formulas to Feishu Sheets formulas. The core goal is not to preserve the original Excel syntax, but to rewrite the formula according to executable Feishu Sheets rules, and to align the results with Excel as much as possible. Use this when the user requests rewriting Excel formulas into Feishu Sheets formulas, or needs to generate Feishu formulas (especially involving ARRAYFORMULA, array semantics and row-by-row filling, native array functions, INDEX/OFFSET, MAP/LAMBDA, date differences, multi-layer range results and secondary expansion). This article is responsible for writing the formula correctly; after putting it into the sheet, you must use references/lark-sheets-formula-verify.md to diagnose the formula range segment by segment. |
Tool reference by object (including shortcuts)
| Reference | Description |
|---|---|
| Lark Sheet Formula Verify | Formula writing / batch filling / --copy-to-range expansion / completion check after importing a workbook containing formulas. For ordinary formulas, scan segment by segment according to the range newly added or modified this time, and merge compilation failures and 7 types of runtime errors;partial continue splitting, and after all status='success' is completed. For AI formulas use --ai-only Perform one asynchronous status check over the entire write range; if pending, you may explain and then deliver. |
| Lark Sheet Workbook | Manage the workbook structure (worksheet list and metadata) of a Lark spreadsheet. Use when the user mentions "see what's in this spreadsheet", "spreadsheet structure", "what sheets are there", "create a new sheet", "delete this worksheet", "rename", "make a copy", or "move to the front". |
| Lark Sheet Sheet Structure | Manage the worksheet structure and layout of a Lark spreadsheet: view row height and column width, hide, merge, freeze, and group, and perform physical structure operations such as inserting/deleting/moving rows and columns. For grouped data statistics, use lark-sheets-pivot-table. For ordinary appending at the end of a table, prefer lark-sheets-write-cells's +table-put --mode append to automatically locate the last row; use this reference first only when the user explicitly requires physically inserting rows or columns, inheriting a template structure, or expanding the layout. |
| Lark Sheet Read Data | Read cell data in a Lark spreadsheet. Use when the user needs to "look at the data", "analyze the data", or "count/summarize"; also applies to scenarios that need to view detailed information such as formulas, styles, and comments. |
| Lark Sheet Search & Replace | Search for and replace text in a Lark spreadsheet, supporting limiting the range, case matching, exact matching, and regular expressions. Use when the user needs to "find", "search", or "locate" a value, or to "replace", "batch modify text", or "change A to B". Do not use it to understand spreadsheet structure (you should read data instead), do not use it for data analysis (you should read data and then calculate instead), and do not treat keywords in the user's action (such as "summarize amount" or "count quantity") as search terms. |
| Lark Sheet Write Cells | Batch write values, formulas, styles, comments, or cell images to a specified range in a Lark spreadsheet. For plain text, use +csv-put; for amounts, percentages, dates, booleans, counts, and columns that will later participate in aggregation, use +table-put and explicitly declare dtypes/formats; for formulas or rich fields, use +cells-set. To append data, use +table-put --mode appenddirectly; only when physical row/column insertion is explicitly required should you go through lark-sheets-sheet-structure first. After a formula is written to the sheet, lark-sheets-formula-verify must be run. |
| Lark Sheet Range Operations | Perform structural operations on a specified range in a Lark spreadsheet (without writing cell data values). Applicable scenarios: clearing content or formatting ("clear", "delete content", "remove formatting"), merging/unmerging cells, adjusting row height and column width ("widen column", "auto-fit column width"), and moving/copying/filling/sorting data ("move data", "copy to", "auto-fill", "sort by a column"). To write cell data, use lark-sheets-write-cells. |
| Lark Sheet Styles Put | Apply a declarative visual specification (styles/borders/merges/row height and column width/freeze) to multiple worksheets of an existing Lark spreadsheet in one go, submitting the entire specification at once. Use when the task is to do beautification and finishing on an existing table, batch-apply styles, or unify the layout. For style value standards, see lark-sheets-visual-standards; to create a new table with styles, use lark-sheets-workbook (+workbook-create --styles); to write data with styles in sync, use lark-sheets-write-cells (+table-put --styles); all three share the same --styles vocabulary. For Lark spreadsheets only. |
| Lark Sheet Batch Update | Merge multiple Lark spreadsheet write operations into a single batch execution, completed sequentially in order. Suitable for scenarios that require executing multiple write operations consecutively (such as modifying the structure first and then writing data). |
| Lark Sheet Chart | Manage charts in Lark Sheets (column charts, line charts, pie charts, bar charts, area charts, scatter charts, combo charts, radar charts, etc.). Use when the user needs to create charts, modify chart styles or data sources, view existing chart configurations, or delete charts. Also applies to data visualization-related scenarios such as when the user mentions "data visualization", "draw a chart", "trend analysis", "comparison chart", "proportion analysis", or "make a chart". |
| Lark Sheet Pivot Table | Manage pivot tables in Lark Sheets. Use when the user needs to create a pivot table, modify the pivot table's row/column fields, aggregation method, or filter conditions, view an existing pivot table configuration, or delete a pivot table. Also applies to scenarios such as when the user mentions "grouped summary", "cross analysis", "statistics by XXX", "group by field", "group further", "multidimensional analysis", or "pivot table". |
| Lark Sheet Conditional Format | Manage conditional formatting rules in Lark Sheets (duplicate value highlighting, cell value comparison, data bars, color scales, rankings, custom formulas, etc.). Use when the user needs to create conditional formatting, modify the range or style of existing rules, view the current conditional formatting configuration, or delete rules. Also applies to scenarios such as when the user mentions "highlight", "mark red", "color marking", "data bars", "color scales", or "conditional styles". |
| Lark Sheet Filter | Manage filters in Lark Sheets. Use when the user needs to filter data (filter rows by text/numeric/color/date conditions), view existing filter configurations, or modify or delete filters. Also applies to scenarios such as "only show", "filter out", and "keep only those that meet the conditions". |
| Lark Sheet Filter View | Manage filter views in Lark Sheets. Use when the user needs to "create an XX view", "save this filter state", "switch between different filters", or maintain multiple independent filter configurations on one sheet. Views and filters are independent of each other and can coexist on the same sheet; hidden rows in a view take effect locally only when the user enters that view and do not affect other collaborators. |
| Lark Sheet Sparkline | Manage sparklines in Lark Sheets (line sparklines, column sparklines, win/loss sparklines). Use when the user needs to embed small charts within cells to display data trends. Also applies to scenarios such as "trend line", "chart within a cell", and "sparkline". Note: not the same as the disabled SPARKLINE() formula function. |
| Lark Sheet Float Image | Manage floating images in Lark Sheets. Use when the user needs to insert floating images into a sheet, adjust image position and size, view existing floating images, or delete images. Also applies to scenarios such as "insert image", "add logo", and "put an image". Note: if the user needs to embed an image inside a cell (cell image), please read lark-sheets-write-cells. |
| Lark Sheet History | Query the historical versions of a Lark Sheet and roll back to a specified version. Use when the user needs to view the list of historical edited versions of a sheet, roll back to a historical version, or query the asynchronous status of a rollback (in progress/success/failure). Rollback is an asynchronous operation; after initiating it, poll the result through status queries. Only for Lark Sheets. |
| Lark Sheet Changeset | Read the changeset (raw list of change operations) between two versions (CS revisions), used to review whether a certain edit—especially an AI edit—actually satisfies the user's request. Pass in the starting version (baseline before the edit), optionally the ending version (if omitted, the latest is used), with a maximum version difference of 20; the outermost returned result includes the latest version number of the current sheet. Use when the user needs to "see what was changed this time", "verify AI changes", or "compare the changes between two versions". |
Common flags quick reference
Under each reference's shortcut title, use a one-line badge to indicate the supported public / system flags (such as _公共四件套 · 系统:--dry-run_). type / required / description are declared uniformly in this section:
Public flags (resource targeting)
Public four-piece set = --url / --spreadsheet-token / --sheet-id / --sheet-name, split into two XOR groups,each group must be given exactly one(XOR = one of two is required, not "optional") —spreadsheet refers to the workbook,sheet refers to the sheet; objects such as conditional formatting / charts / filter views / pivot tables / sparklines / floating images use their own --*-id outside the four-piece set for targeting:
- spreadsheet targeting (required):
--url(parses the three kinds of links:/sheets/、/spreadsheets/、/wiki/; wiki links automatically locate the underlying spreadsheet) and--spreadsheet-token(bare token), choose one of the two.Exception:+workbook-create/+workbook-importoutputdoes not yet existfor the table; it accepts no targeting flags. - sheet targeting (required for the public four-piece set shortcut):
--sheet-idand--sheet-name, choose one of the two.- ⚠️ When unsure of the sheet name, do not guess
Sheet1: unless a specific value has already appeared in the conversation or context, first+workbook-infoto getsheets[].sheet_id/titlethen choose — subtables of Chinese spreadsheets are often named "数据"/"工作表 1"/business names, and guessing the name will most likely hitsheet not found。 - ⚠️
--rangeinSheet1!prefix cannot replace sheet targeting: you must still pass--sheet-id/--sheet-name。 - ⚠️ When an A1 reference contains
!, wrap the whole segment in single quotes(--range 'Sheet1!A1:B2', to block bash history expansion; do not useset +H, which is invalid under sh/dash). When the sheet name needs to be wrapped in another layer of single quotes inside A1, use'\''to escape. - Exception: shortcuts whose badge marks
_公共:URL/token(无 sheet 定位)…_do not accept sheet targeting — workbook-level (+workbook-info/+sheet-list/+sheet-create/+revision-get/+changeset-get/+history-list|revert|revert-status), batch and whole-table level (+batch-update/+batch-chart-create|update/+cells-batch-clear/+styles-put/+dropdown-update|delete), as well as+table-put。+workbook-exportwhere the subtable name is written in the payload, only accept--sheet-id(when there is no--sheet-name),+pivot-createuse--target-sheet-id/name(XOR, both may be omitted). The badge is the criterion; this line is only a shorthand.
- ⚠️ When unsure of the sheet name, do not guess
# 统一调用范式:两组定位缺一不可(占位符别原样填;表名先 +workbook-info 查)
lark-cli sheets +csv-get --url "https://.../sheets/shtXXX" --sheet-name "<真实表名>" --range "A1:F30"
System flags
| Flag | Type | Required | Description |
|---|---|---|---|
--dry-run |
bool | No | Zero side effects: only prints the request path and parameter template, does not make a call |
--yes |
bool | Yes (only high-risk-write) |
second confirmation; exit code 10 when omitted. See ../lark-shared/SKILL.md high-risk approval protocol |
--print-schema |
bool | No | Before writing a composite JSON flag, if the structure is uncertain, run it first: it prints the Schema locally and exits (no call is made, no other required flag is needed). Use it with --flag-name to specify which flag to look up; when omitted, it lists the flags queryable for that shortcut. Only shortcuts containing composite JSON flags support this. |
--flag-name |
string | No | Works with --print-schema: the flag name does not carry the -- prefix (cells / properties)。supports dot-separated path slicing:--flag-name properties.snapshot.plotArea.axes , only prints that subtree; for large schemas (chart's properties is about 1700 lines), fetch as needed, do not page through the whole thing. |
bool flag syntax: to enable, a bare
--flagmay be used; for explicit values use only--flag=trueor--flag=false, they must not be separated by a space.
⚠️ high-risk-write command list (exit 10 hard confirmation gate):
+batch-update、+cells-clear、+cells-batch-clear、+sheet-delete、+dim-delete、+dropdown-delete、+history-revert(roll back the entire table to a historical version), as well as deletion of each object+chart-delete/+pivot-delete/+cond-format-delete/+filter-delete/+filter-view-delete/+sparkline-delete/+float-image-delete。Approval protocol: first
--dry-runpreview, show the user the operations to be executed and the scope of impact,after obtaining the user's explicit consentthen append--yesto the original command to execute. Without the user's consent, do not include--yes, and do not silently add--yesto retry after exit 10—that is equivalent to disabling the gate. For the full protocol see../lark-shared/SKILL.md。
Boundaries of the Schema:--print-schema prints the internal structure of the flag value; when the flag description requires an outer envelope (such as --sheets of {"sheets":[…]}), that layer is not visible in the schema, so add it according to the description; the reference's ## Schemas section also provides only one layer. For the diagram, directly +chart-create --print-example <type> take the minimal usable template and modify the parameters.
Flag content types and output conventions (terminology quick reference)
- JSON-type input parameters fall into three categories:complex JSON = deeply nested objects (
--print-schemacan be queried);simple JSON = one- or two-dimensional scalar arrays;non-JSON text = verbatim text (such as CSV). - envelope: all shortcuts return a unified outer
{ok, identity, data, ...}; write operations do not automatically read back, so call+*-list/+*-get/+cells-get。 - Large payloads go through files / stdin, not inline in the command line: flags marked Type
File + Stdinsupport--flag "@./x.json"(@fileonly accept relative paths under cwd; absolute paths are rejected) and--flag -(stdin); when the payload contains newlines / quotes or is large in size, always write it to a file.stdin can provide only one flag per invocation——+table-putof--sheetsand--stylesare both large JSON, one goes through-and the other goes through@./x.json. Do not put temporary files into the user's project directory. - Adaptation for non-POSIX shells (PowerShell / cmd.exe): all of this skill's
bashcode blocks (heredoc<<'JSON', single-quote escaping'\'') apply only to bash / zsh. Determine the current shell before acting; in non-POSIX environments rewrite according to the table below,do not change quotes by trial and error——@file(cwd-relative path) is the fallback form with no quoting issues on all platforms:
| Form | bash / zsh | PowerShell | cmd.exe |
|---|---|---|---|
| Large / multiline JSON | --flag - <<'JSON' … JSON |
First write a UTF-8 file without BOM, then --flag '@./x.json', or Get-Content -Raw ./x.json | lark-cli … --flag - |
first write to a file, then --flag @./x.json(cmd has no heredoc / reading files through pipes is unreliable) |
| Single-line inline JSON | --flag '{"a":1}' |
--flag '{"a":1}'(PS single quotes are likewise literals) |
Do not inline—cmd will consume the inner double quotes; always use @file |