Feishu Node icon

Feishu Node

Feishu Node

Actions106

Overview

This node operation allows users to set the style of cells within a specified range in an electronic spreadsheet. It is useful for automating the formatting of spreadsheets, such as adjusting font styles, colors, alignments, borders, and number formats programmatically. Typical scenarios include preparing reports with consistent styling, highlighting important data, or applying corporate branding styles across multiple sheets.

For example, you can use this node to:

  • Make header rows bold and center-aligned.
  • Apply background colors to specific ranges to indicate status.
  • Set number formats for financial data.
  • Add borders around tables for better readability.

Properties

Name Meaning
电子表格 Token The token used to authenticate access to the electronic spreadsheet.
设置范围 The cell range to apply styles to, formatted as <sheetId>!<startCell>:<endCell>. For example, Sheet1!A1:C3 applies styles to cells A1 through C3 on Sheet1.
需要更新的样式 Collection of style settings to update. Includes:
- 字体相关样式 Font-related styles:
-- 字体大小 Font size (e.g., "10pt") and line height (fixed at 1.5px). Font size range is 9 to 36 pt.
-- 是否加粗 Boolean to set bold font.
-- 是否斜体 Boolean to set italic font.
-- 是否清除字体格式 Boolean to clear existing font formatting.
- 文本装饰 Text decoration options: None, Underline, Strikethrough, or Both underline and strikethrough.
- 数字格式 Number format string supported by the spreadsheet application (e.g., currency, percentage formats).
- 水平对齐方式 Horizontal alignment: 0 = left, 1 = center, 2 = right.
- 垂直对齐方式 Vertical alignment: 0 = top, 1 = middle, 2 = bottom.
- 字体颜色 Font color specified as a hexadecimal color code (e.g., "#FF0000" for red).
- 背景颜色 Background fill color specified as a hexadecimal color code.
- 边框类型 Border type options: FULL_BORDER, OUTER_BORDER, INNER_BORDER, NO_BORDER, LEFT_BORDER, RIGHT_BORDER, TOP_BORDER, BOTTOM_BORDER.
- 边框颜色 Border color specified as a hexadecimal color code.

Output

The node outputs JSON data representing the result of the style update operation. Typically, this will confirm success or provide details about the updated range. The exact structure depends on the underlying API response but generally includes metadata about the applied styles.

If the node supports binary output (not indicated here), it would represent any binary data returned by the spreadsheet service, such as styled document snapshots or images, but this is not evident from the provided code.

Dependencies

  • Requires an API token credential to authenticate with the electronic spreadsheet service.
  • The node relies on an external resource factory to build and execute the appropriate API call based on the selected resource and operation.
  • No additional environment variables are explicitly required beyond the API token.

Troubleshooting

  • Common issues:

    • Invalid or expired token leading to authentication failures.
    • Incorrectly formatted range strings causing errors in identifying target cells.
    • Unsupported or malformed style properties resulting in API rejection.
  • Error messages:

    • "未实现方法: 电子表格.设置单元格样式" ("Unimplemented method: spreadsheet.setCellStyle"): This indicates the operation is not implemented or recognized; verify that the resource and operation names are correct.
    • API errors wrapped as NodeApiError: These usually contain detailed error messages from the spreadsheet service; check the message for specifics like invalid parameters or permission issues.
  • Resolutions:

    • Ensure the token is valid and has sufficient permissions.
    • Double-check the range format matches <sheetId>!<startCell>:<endCell>.
    • Validate style property values against allowed types and ranges.
    • Use the node's "Continue On Fail" option to handle partial failures gracefully.

Links and References

  • Refer to your electronic spreadsheet service’s official documentation for supported number formats and style options.
  • Consult n8n documentation on how to configure API credentials securely.
  • For color codes, see HTML Color Codes.

Note: The summary is based solely on static analysis of the provided source and property definitions without runtime execution or internal credential naming details.

Discussion