anthropics / anthropics/skills

xlsx skill: presentation gotchas — merge banner cells (fill doesn't overflow) and escape & in headers/footers

Open Beginner friendly
#1,440 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
176k
Forks
20.9k
Avg merge
7h 21m
Merged PRs (30d)
5

Description

## Summary

The `xlsx` skill (`skills/xlsx/SKILL.md`) gives solid guidance on data and formula correctness (recalc, zero-error checks, conventions), but it doesn't mention a couple of openpyxl **presentation** gotchas that silently produce visually broken output. Both are within the skill's existing scope (authoring xlsx with openpyxl). Reporting them with a minimal repro and fix. (This is separate from #584, which covers formula/OOXML compatibility.)

## Gap 1 — a filled title/banner cell does not overflow, so titles get clipped

A very common layout is a title in `A1` with a background fill, where the text is wider than column A and relies on overflow into the empty neighbor cells. Two issues:

- The **fill** only covers `A1`, so the colored banner does not span the width of the table below it.
- The overflow **text** is not shown reliably — it gets clipped at the cell boundary in many renderers, and it's worst when the first column is narrow (e.g. a numbering / `#` column only a few characters wide, which clips the title down to a few letters).

This is easy to miss because some viewers (e.g. Google Sheets) render the overflow on screen so it looks fine, while other renderers/exports clip it at the cell boundary.

**Fix** — merge the banner across the table width so both the fill and the text span correctly:

```python
from openpyxl.utils import get_column_letter
last = get_column_letter(ws.max_column)
ws.merge_cells(f"A1:{last}1") # title banner
ws.merge_cells(f"A2:{last}2") # subtitle, if any
```

A one-line note in the formatting section — "for a title/banner that spans multiple columns, merge the cells; a fill and long text do not overflow reliably" — would prevent this.

## Gap 2 — `&` in headers/footers is a field-code escape character

`&` starts a field code in Excel header/footer strings (`&C` = center section, `&L` / `&R` = left / right section, `&P` = page number, `&D` = date, etc.). A literal `&` in footer/header text is therefore misinterpreted:

```python
ws.oddFooter.left.text = "Revenue & Costs" # "&C" is read as the center-section code
```

renders as `Revenue ` on the left, with everything after `&C` pushed into the center section. A literal ampersand must be doubled:

```python
ws.oddFooter.left.text = "Revenue && Costs" # renders "Revenue & Costs"
```

Worth a one-line note wherever header/footer text is shown.

Contributor guide

No contributing guide indexed for this repository

Research direction

Open skills/xlsx/SKILL.md and find the formatting and header/footer guidance. Add a note explaining that title banners should merge across the table width because fills and long text do not overflow reliably, and that literal ampersands in header/footer text must be escaped by doubling them. Done means both openpyxl presentation gotchas and their fixes are documented in the existing skill scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.