Skip to content

fix(excel): remove unwanted index column from Excel exports#38176

Merged
rusackas merged 2 commits intomasterfrom
fix-excel-export-index
Feb 23, 2026
Merged

fix(excel): remove unwanted index column from Excel exports#38176
rusackas merged 2 commits intomasterfrom
fix-excel-export-index

Conversation

@rusackas
Copy link
Member

Summary

The Excel export was including an unwanted index column (row numbers 0, 1, 2...) because df.to_excel() defaults to index=True. CSV export already handled this correctly by passing index=include_index.

This fix applies the same logic to Excel exports: only include the index column if the DataFrame has a custom index (not a RangeIndex).

Before:
Image

After: The first column with row numbers will no longer appear.

Test plan

  • Export a chart to Excel and verify no unwanted index column appears
  • Verify CSV export still works correctly
  • Verify DataFrames with custom indices still export the index

Closes #32113
Related: #22981, #29717

🤖 Generated with Claude Code

The Excel export was including an unwanted index column because
`df.to_excel()` defaults to `index=True`. CSV export already handled
this correctly by passing `index=include_index`.

This fix applies the same logic to Excel exports: only include the
index column if the DataFrame has a custom index (not a RangeIndex).

Closes #32113

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dosubot
Copy link

dosubot bot commented Feb 23, 2026

Related Documentation

Checked 0 published document(s) in 2 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 23, 2026

Code Review Agent Run #41d749

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: adb3a7f..adb3a7f
    • superset/common/query_context_processor.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Update Excel export tests to expect the new index=False argument
passed to df_to_excel() which removes the unwanted index column.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Feb 23, 2026

Code Review Agent Run #00e019

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: adb3a7f..7e65692
    • superset/common/query_context_processor.py
    • tests/unit_tests/common/test_query_context_processor.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Member

@msyavuz msyavuz left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@rusackas rusackas merged commit c4eb7de into master Feb 23, 2026
61 checks passed
@rusackas rusackas deleted the fix-excel-export-index branch February 23, 2026 16:28
sadpandajoe pushed a commit that referenced this pull request Feb 25, 2026
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit c4eb7de)
@sadpandajoe sadpandajoe added the v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unwanted index column always included in Excel export

3 participants