Skip to content

fix: Filter blank sheet#2237

Merged
liuruibin merged 1 commit intomainfrom
pr@main@fix_filter_blank
Feb 11, 2025
Merged

fix: Filter blank sheet#2237
liuruibin merged 1 commit intomainfrom
pr@main@fix_filter_blank

Conversation

@shaohuzhang1
Copy link
Contributor

fix: Filter blank sheet --bug=1052097 --user=刘瑞斌 【github#2196】【应用编排】应用对话的时候上传带空白sheet的表格会报错 https://www.tapd.cn/57709429/s/1653414

--bug=1052097 --user=刘瑞斌 【github#2196】【应用编排】应用对话的时候上传带空白sheet的表格会报错 https://www.tapd.cn/57709429/s/1653414
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Feb 11, 2025

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.

Details

Instructions 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.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Feb 11, 2025

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

continue

# 获取表头和内容
headers = sheet.row_values(0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@liuruibin liuruibin merged commit 89c08b4 into main Feb 11, 2025
4 checks passed
@liuruibin liuruibin deleted the pr@main@fix_filter_blank branch February 11, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants