$npx -y skills add henkisdabro/wookstar-claude-plugins --skill xlsxComprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualisation. Use when working with spreadsheets (.xlsx, .xlsm, .csv, .tsv) for creating new spreadsheets with formulas and formatting, reading or analysing data,
| 1 | # Requirements for Outputs |
| 2 | |
| 3 | ## All Excel Files |
| 4 | |
| 5 | ### Zero Formula Errors |
| 6 | |
| 7 | - Every Excel model MUST be delivered with ZERO formula errors (#REF!, #DIV/0!, #VALUE!, #N/A, #NAME?) |
| 8 | |
| 9 | ### Preserve Existing Templates (when updating templates) |
| 10 | |
| 11 | - Study and EXACTLY match existing format, style, and conventions when modifying files |
| 12 | - Never impose standardised formatting on files with established patterns |
| 13 | - Existing template conventions ALWAYS override these guidelines |
| 14 | |
| 15 | ## Financial Models |
| 16 | |
| 17 | For financial models, DCFs, and valuations - read `references/financial-model-standards.md` for colour coding, number formatting, formula construction rules, and documentation requirements. |
| 18 | |
| 19 | # XLSX Creation, Editing, and Analysis |
| 20 | |
| 21 | ## Overview |
| 22 | |
| 23 | A user may ask you to create, edit, or analyse the contents of an .xlsx file. You have different tools and workflows available for different tasks. |
| 24 | |
| 25 | ## Important Requirements |
| 26 | |
| 27 | **LibreOffice Required for Formula Recalculation**: You can assume LibreOffice is installed for recalculating formula values using the `recalc.py` script. The script automatically configures LibreOffice on first run. |
| 28 | |
| 29 | ## Reading and Analysing Data |
| 30 | |
| 31 | ### Data analysis with pandas |
| 32 | |
| 33 | For data analysis, visualisation, and basic operations, use **pandas** which provides powerful data manipulation capabilities: |
| 34 | |
| 35 | ```python |
| 36 | import pandas as pd |
| 37 | |
| 38 | # Read Excel |
| 39 | df = pd.read_excel('file.xlsx') # Default: first sheet |
| 40 | all_sheets = pd.read_excel('file.xlsx', sheet_name=None) # All sheets as dict |
| 41 | |
| 42 | # Analyse |
| 43 | df.head() # Preview data |
| 44 | df.info() # Column info |
| 45 | df.describe() # Statistics |
| 46 | |
| 47 | # Write Excel |
| 48 | df.to_excel('output.xlsx', index=False) |
| 49 | ``` |
| 50 | |
| 51 | ## CRITICAL: Use Formulas, Not Hardcoded Values |
| 52 | |
| 53 | **Always use Excel formulas instead of calculating values in Python and hardcoding them.** This ensures the spreadsheet remains dynamic and updateable. |
| 54 | |
| 55 | ### Bad - Hardcoding Calculated Values |
| 56 | |
| 57 | ```python |
| 58 | # Bad: Calculating in Python and hardcoding result |
| 59 | total = df['Sales'].sum() |
| 60 | sheet['B10'] = total # Hardcodes 5000 |
| 61 | |
| 62 | # Bad: Computing growth rate in Python |
| 63 | growth = (df.iloc[-1]['Revenue'] - df.iloc[0]['Revenue']) / df.iloc[0]['Revenue'] |
| 64 | sheet['C5'] = growth # Hardcodes 0.15 |
| 65 | |
| 66 | # Bad: Python calculation for average |
| 67 | avg = sum(values) / len(values) |
| 68 | sheet['D20'] = avg # Hardcodes 42.5 |
| 69 | ``` |
| 70 | |
| 71 | ### Correct - Using Excel Formulas |
| 72 | |
| 73 | ```python |
| 74 | # Good: Let Excel calculate the sum |
| 75 | sheet['B10'] = '=SUM(B2:B9)' |
| 76 | |
| 77 | # Good: Growth rate as Excel formula |
| 78 | sheet['C5'] = '=(C4-C2)/C2' |
| 79 | |
| 80 | # Good: Average using Excel function |
| 81 | sheet['D20'] = '=AVERAGE(D2:D19)' |
| 82 | ``` |
| 83 | |
| 84 | This applies to ALL calculations - totals, percentages, ratios, differences, etc. The spreadsheet should be able to recalculate when source data changes. |
| 85 | |
| 86 | ## Common Workflow |
| 87 | |
| 88 | 1. **Choose tool**: pandas for data, openpyxl for formulas/formatting |
| 89 | 2. **Create/Load**: Create new workbook or load existing file |
| 90 | 3. **Modify**: Add/edit data, formulas, and formatting |
| 91 | 4. **Save**: Write to file |
| 92 | 5. **Recalculate formulas (MANDATORY IF USING FORMULAS)**: Use the recalc.py script |
| 93 | ```bash |
| 94 | python recalc.py output.xlsx |
| 95 | ``` |
| 96 | 6. **Verify and fix any errors**: |
| 97 | - The script returns JSON with error details |
| 98 | - If `status` is `errors_found`, check `error_summary` for specific error types and locations |
| 99 | - Fix the identified errors and recalculate again |
| 100 | - Common errors to fix: |
| 101 | - `#REF!`: Invalid cell references |
| 102 | - `#DIV/0!`: Division by zero |
| 103 | - `#VALUE!`: Wrong data type in formula |
| 104 | - `#NAME?`: Unrecognised formula name |
| 105 | |
| 106 | For detailed code examples (creating/editing files), read `references/openpyxl-patterns.md`. |
| 107 | |
| 108 | ## Recalculating Formulas |
| 109 | |
| 110 | Excel files created or modified by openpyxl contain formulas as strings but not calculated values. Use the provided `recalc.py` script to recalculate: |
| 111 | |
| 112 | ```bash |
| 113 | python recalc.py <excel_file> [timeout_seconds] |
| 114 | ``` |
| 115 | |
| 116 | Example: |
| 117 | |
| 118 | ```bash |
| 119 | python recalc.py output.xlsx 30 |
| 120 | ``` |
| 121 | |
| 122 | The script: |
| 123 | |
| 124 | - Automatically sets up LibreOffice macro on first run |
| 125 | - Recalculates all formulas in all sheets |
| 126 | - Scans ALL cells for Excel errors (#REF!, #DIV/0!, etc.) |
| 127 | - Returns JSON with detailed error locations and counts |
| 128 | - Works on both Linux and macOS |
| 129 | |
| 130 | For the formula verification checklist and recalc.py output interpretation, read `references/formula-verification.md`. |
| 131 | |
| 132 | ## Code Style Guidelines |
| 133 | |
| 134 | **IMPORTANT**: When generating Python code for Excel operations: |
| 135 | |
| 136 | - Write minima |