Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.9.50 #195

Merged
merged 1 commit into from
May 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions czsc/fsa/spreed_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,29 @@ def read_table(self, token, sheet_id):
cols = values.pop(0)
return pd.DataFrame(values, columns=cols)

def get_condition_formats(self, token, sheet_id):
"""获取表格条件格式
https://open.feishu.cn/document/server-docs/docs/sheets-v3/conditionformat/condition-format-get

:return:
"""
url = f"{self.host}/open-apis/sheets/v2/spreadsheets/{token}/condition_formats?sheet_ids={sheet_id}"
return request("GET", url, self.get_headers())

def set_condition_formats(self, token, data):
"""设置表格条件格式
https://open.feishu.cn/document/server-docs/docs/sheets-v3/conditionformat/condition-format-set
"""
url = f"{self.host}/open-apis/sheets/v2/spreadsheets/{token}/condition_formats/batch_create"
return request("POST", url, self.get_headers(), data)

def set_styles_batch(self, token,data):
"""批量设置表格普通样式
https://open.feishu.cn/document/server-docs/docs/sheets-v3/data-operation/batch-set-cell-style
"""
url = f"{self.host}/open-apis/sheets/v2/spreadsheets/{token}/styles_batch_update"
return request("PUT", url, self.get_headers(), data)


class SingleSheet(SpreadSheets):
"""飞书表格中单个工作表的操作,继承自 SpreadSheets"""
Expand Down Expand Up @@ -380,3 +403,4 @@ def single_delete_values(self):
删除电子表格的所有数据
"""
super().delete_values(self.token, self.sheet_id)

Loading