Conversation
--bug=1052097 --user=刘瑞斌 【github#2196】【应用编排】应用对话的时候上传带空白sheet的表格会报错 https://www.tapd.cn/57709429/s/1653414
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| continue | ||
|
|
||
| # 获取表头和内容 | ||
| headers = sheet.row_values(0) |
There was a problem hiding this comment.
Your code looks well-written and should work correctly. However, there is no need to iterate over blank sheets. A better approach would be to skip such sheets directly during the loop instead of after it.
Here's an optimized version:
for sheet in sheets:
# Get table headers and content only for non-blank sheets
if sheet.nrows > 0 and sheet.ncols > 0:
headers = sheet.row_values(0)This way, you avoid iterating over and processing empty worksheets at all.
fix: Filter blank sheet --bug=1052097 --user=刘瑞斌 【github#2196】【应用编排】应用对话的时候上传带空白sheet的表格会报错 https://www.tapd.cn/57709429/s/1653414