{"id":"264ca168-fd24-4a94-aa3f-dcd9a6c9f923","shortId":"aXHsgq","kind":"skill","title":"xlsx","tagline":"Spreadsheet creation, editing, and analysis. Two approaches: Programmatic (openpyxl/pandas for .xlsx files with formulas, formatting, and data analysis) and Browser-based (Excel Online via Playwright for pivot tables, charts, and collaboration). Use when the user wants to create,","description":"# XLSX — Spreadsheet Skill\n\nTwo approaches for working with spreadsheets depending on the task:\n\n| Approach | Tool | Best For |\n|----------|------|----------|\n| Programmatic | openpyxl / pandas | Creating files, bulk data, formulas, automation |\n| Browser-based | Excel Online via Playwright | Pivot tables, charts, collaboration, interactive editing |\n\n---\n\n## Part 1: Programmatic Approach (openpyxl / pandas)\n\n### Requirements for All Excel Outputs\n\n#### Professional Font\n- Use a consistent, professional font (e.g., Arial, Times New Roman) unless otherwise instructed\n\n#### Zero Formula Errors\n- Every Excel model MUST be delivered with ZERO formula errors (#REF!, #DIV/0!, #VALUE!, #N/A, #NAME?)\n\n#### Preserve Existing Templates\n- Study and EXACTLY match existing format, style, and conventions when modifying files\n- Existing template conventions ALWAYS override these guidelines\n\n### Financial Model Standards\n\n#### Color Coding (Industry-Standard)\n- **Blue text (RGB: 0,0,255)**: Hardcoded inputs and scenario-adjustable numbers\n- **Black text (RGB: 0,0,0)**: ALL formulas and calculations\n- **Green text (RGB: 0,128,0)**: Links pulling from other worksheets\n- **Red text (RGB: 255,0,0)**: External links to other files\n- **Yellow background (RGB: 255,255,0)**: Key assumptions needing attention\n\n#### Number Formatting\n- **Years**: Format as text strings (\"2024\" not \"2,024\")\n- **Currency**: Use $#,##0 format; ALWAYS specify units in headers (\"Revenue ($mm)\")\n- **Zeros**: Use formatting to display as \"-\" including percentages\n- **Percentages**: Default to 0.0% format (one decimal)\n- **Multiples**: Format as 0.0x for valuation multiples\n- **Negative numbers**: Use parentheses (123) not minus -123\n\n#### Formula Rules\n- Place ALL assumptions in separate cells, use cell references in formulas\n- Use `=B5*(1+$B$6)` instead of `=B5*1.05`\n- Document hardcodes with source comments\n\n### CRITICAL: Use Formulas, Not Hardcoded Values\n\nAlways use Excel formulas instead of calculating values in Python and hardcoding them.\n\n```python\n# WRONG - Hardcoding calculated values\ntotal = df['Sales'].sum()\nsheet['B10'] = total  # Hardcodes 5000\n\n# CORRECT - Using Excel formulas\nsheet['B10'] = '=SUM(B2:B9)'\nsheet['C5'] = '=(C4-C2)/C2'\nsheet['D20'] = '=AVERAGE(D2:D19)'\n```\n\n### Reading and Analyzing Data\n\n```python\nimport pandas as pd\n\n# Read Excel\ndf = pd.read_excel('file.xlsx')                    # Default: first sheet\nall_sheets = pd.read_excel('file.xlsx', sheet_name=None)  # All sheets as dict\n\n# Analyze\ndf.head()      # Preview data\ndf.info()      # Column info\ndf.describe()  # Statistics\n\n# Write Excel\ndf.to_excel('output.xlsx', index=False)\n```\n\n### Creating New Excel Files\n\n```python\nfrom openpyxl import Workbook\nfrom openpyxl.styles import Font, PatternFill, Alignment\n\nwb = Workbook()\nsheet = wb.active\n\n# Add data\nsheet['A1'] = 'Hello'\nsheet['B1'] = 'World'\nsheet.append(['Row', 'of', 'data'])\n\n# Add formula\nsheet['B2'] = '=SUM(A1:A10)'\n\n# Formatting\nsheet['A1'].font = Font(bold=True, color='FF0000')\nsheet['A1'].fill = PatternFill('solid', start_color='FFFF00')\nsheet['A1'].alignment = Alignment(horizontal='center')\n\n# Column width\nsheet.column_dimensions['A'].width = 20\n\nwb.save('output.xlsx')\n```\n\n### Editing Existing Files\n\n```python\nfrom openpyxl import load_workbook\n\nwb = load_workbook('existing.xlsx')\nsheet = wb.active  # or wb['SheetName']\n\n# Working with multiple sheets\nfor sheet_name in wb.sheetnames:\n    sheet = wb[sheet_name]\n\n# Modify cells\nsheet['A1'] = 'New Value'\nsheet.insert_rows(2)\nsheet.delete_cols(3)\n\n# Add new sheet\nnew_sheet = wb.create_sheet('NewSheet')\nnew_sheet['A1'] = 'Data'\n\nwb.save('modified.xlsx')\n```\n\n### Recalculating Formulas\n\n**LibreOffice Required**: Use the provided `scripts/recalc.py` script to recalculate formula values.\n\n```bash\npython scripts/recalc.py output.xlsx 30\n```\n\nThe script:\n- Automatically sets up LibreOffice macro on first run\n- Recalculates all formulas in all sheets\n- Scans ALL cells for Excel errors\n- Returns JSON with detailed error locations and counts\n\n```json\n{\n  \"status\": \"success\",\n  \"total_errors\": 0,\n  \"total_formulas\": 42,\n  \"error_summary\": {}\n}\n```\n\n### Formula Verification Checklist\n\n- [ ] Test 2-3 sample references before building full model\n- [ ] Confirm column mapping (column 64 = BL, not BK)\n- [ ] Remember row offset (DataFrame row 5 = Excel row 6)\n- [ ] Handle NaN with `pd.notna()`\n- [ ] Check far-right columns (FY data often in columns 50+)\n- [ ] Verify cross-sheet references use correct format (Sheet1!A1)\n- [ ] Test edge cases: zero, negative, and very large values\n\n### Library Selection Guide\n\n- **pandas**: Best for data analysis, bulk operations, simple data export\n- **openpyxl**: Best for complex formatting, formulas, and Excel-specific features\n- **Warning**: `load_workbook('file.xlsx', data_only=True)` replaces formulas with values if saved\n\n---\n\n## Part 2: Browser-Based Approach (Excel Online)\n\nFor interactive spreadsheet work via Playwright MCP automation.\n\n### Setup\n\nConfigure via canifi-env:\n```bash\ncanifi-env set MICROSOFT_EMAIL \"your-email@outlook.com\"\n```\n\n### Authentication Options\n\n**Option 1: Manual Browser Login (Recommended)**\n1. Complete Browser Automation Setup using CDP mode\n2. Login to Excel Online manually in the Playwright-controlled Chrome window\n3. Claude uses your authenticated session without seeing your password\n\n**Option 2: Environment Variables**\n```bash\ncanifi-env set SERVICE_EMAIL \"your-email\"\ncanifi-env set SERVICE_PASSWORD \"your-password\"\n```\n\n### Browser Capabilities\n- Create and edit spreadsheets\n- Build formulas and functions\n- Create charts and visualizations\n- Apply conditional formatting\n- Create pivot tables\n- Sort and filter data\n- Use data validation\n- Import and export data\n- Collaborate in real-time\n\n### Usage Examples\n\n**Create Spreadsheet:**\n```\nUser: \"Create an expense tracker in Excel\"\nClaude: Creates new workbook \"Expense Tracker\", adds columns for\n        Date, Category, Description, Amount. Adds SUM formula for total.\n```\n\n**Analyze Data:**\n```\nUser: \"Create a pivot table from my sales data\"\nClaude: Selects data range, inserts pivot table,\n        configures rows, columns, and values.\n```\n\n**Create Chart:**\n```\nUser: \"Make a line chart showing revenue trends\"\nClaude: Selects revenue data, inserts line chart,\n        adds titles and labels.\n```\n\n### Selectors Reference\n\n```javascript\n// New workbook\n'[aria-label=\"New blank workbook\"]'\n\n// Cell input\n'.formulabar-input' or 'input[name=\"Cell\"]'\n\n// Ribbon tabs\n'[role=\"tablist\"]'\n'[aria-label=\"Insert\"]'\n'[aria-label=\"Formulas\"]'\n'[aria-label=\"Data\"]'\n\n// Actions\n'[aria-label=\"Insert chart\"]'\n'[aria-label=\"Sort\"]'\n'[aria-label=\"Filter\"]'\n```\n\n### Common Formulas\n\n```\n=SUM(A1:A10)              // Sum range\n=AVERAGE(A1:A10)          // Average\n=VLOOKUP(key,range,col,0) // Vertical lookup\n=IF(condition,true,false)  // Conditional\n=COUNTIF(range,criteria)   // Count matching\n=SUMIF(range,crit,sum)     // Sum matching\n=TEXT(A1,\"format\")         // Format text\n=TODAY()                   // Current date\n=CONCATENATE(A1,B1)        // Join text\n```\n\n### Error Handling\n- **Login Failed**: Retry 3 times, notify user\n- **Session Expired**: Re-authenticate automatically\n- **Workbook Not Found**: Search OneDrive, ask for clarification\n- **Formula Error**: Identify error type, suggest fix\n- **Save Failed**: Enable AutoSave, retry\n\n### Excel Online Limitations\n- Auto-saves to OneDrive\n- Some advanced features only in desktop version\n- Maximum rows: 1,048,576 per sheet\n- Power Query limited in online version\n- Macros not supported in online version\n- Can open and edit .xlsx, .xlsm files\n\n---\n\n## Code Style Guidelines\n\n**For Python code**: Write minimal, concise code without unnecessary comments or verbose variable names.\n\n**For Excel files**: Add comments to cells with complex formulas, document data sources for hardcoded values, include notes for key calculations.","tags":["xlsx","coco","rkz91","agent-skills","agents-md","ai-agents","claude-code","codex","cursor","developer-tools","llm-tools","mcp"],"capabilities":["skill","source-rkz91","skill-xlsx","topic-agent-skills","topic-agents-md","topic-ai-agents","topic-claude-code","topic-codex","topic-cursor","topic-developer-tools","topic-llm-tools","topic-mcp","topic-pm-tools","topic-product-management","topic-productivity"],"categories":["coco"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/rkz91/coco/xlsx","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add rkz91/coco","source_repo":"https://github.com/rkz91/coco","install_from":"skills.sh"}},"qualityScore":"0.453","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 7 github stars · SKILL.md body (7,934 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:14:10.791Z","embedding":null,"createdAt":"2026-05-18T13:21:44.683Z","updatedAt":"2026-05-18T19:14:10.791Z","lastSeenAt":"2026-05-18T19:14:10.791Z","tsv":"'-123':261 '-3':579 '/c2':336 '0':157,158,170,171,172,180,182,192,193,204,222,568,940 '0.0':242,249 '024':219 '048':1025 '1':81,277,707,712,1024 '1.05':283 '123':258 '128':181 '2':218,497,578,675,720,744 '20':455 '2024':216 '255':159,191,202,203 '3':500,733,977 '30':532 '42':571 '5':599 '50':617 '5000':321 '576':1026 '6':279,602 '64':590 'a1':410,424,428,436,444,492,511,627,928,933,960,968 'a10':425,929,934 'action':911 'add':407,419,501,819,826,871,1068 'adjust':165 'advanc':1016 'align':402,445,446 'alway':142,224,295 'amount':825 'analysi':6,19,644 'analyz':344,372,831 'appli':780 'approach':8,45,54,83,679 'aria':881,900,904,908,913,918,922 'aria-label':880,899,903,907,912,917,921 'arial':99 'ask':992 'assumpt':206,266 'attent':208 'authent':704,737,985 'auto':1011 'auto-sav':1010 'autom':66,689,715 'automat':535,986 'autosav':1005 'averag':339,932,935 'b':278 'b1':413,969 'b10':318,327 'b2':329,422 'b5':276,282 'b9':330 'background':200 'base':23,69,678 'bash':528,696,747 'best':56,641,651 'bk':593 'bl':591 'black':167 'blank':884 'blue':154 'bold':431 'browser':22,68,677,709,714,766 'browser-bas':21,67,676 'build':583,772 'bulk':63,645 'c2':335 'c4':334 'c4-c2':333 'c5':332 'calcul':176,301,311,1085 'canifi':694,698,749,758 'canifi-env':693,697,748,757 'capabl':767 'case':630 'categori':823 'cdp':718 'cell':269,271,490,551,886,894,1071 'center':448 'chart':31,76,777,855,860,870,916 'check':607 'checklist':576 'chrome':731 'clarif':994 'claud':734,813,842,864 'code':150,1048,1053,1057 'col':499,939 'collabor':33,77,797 'color':149,433,441 'column':377,449,587,589,611,616,820,851 'comment':288,1060,1069 'common':925 'complet':713 'complex':653,1073 'concaten':967 'concis':1056 'condit':781,944,947 'configur':691,849 'confirm':586 'consist':95 'control':730 'convent':135,141 'correct':322,624 'count':562,951 'countif':948 'creat':40,61,388,768,776,783,804,807,814,834,854 'creation':3 'crit':955 'criteria':950 'critic':289 'cross':620 'cross-sheet':619 'currenc':220 'current':965 'd19':341 'd2':340 'd20':338 'data':18,64,345,375,408,418,512,613,643,648,665,789,791,796,832,841,844,867,910,1076 'datafram':597 'date':822,966 'decim':245 'default':240,357 'deliv':114 'depend':50 'descript':824 'desktop':1020 'detail':558 'df':314,353 'df.describe':379 'df.head':373 'df.info':376 'df.to':383 'dict':371 'dimens':452 'display':235 'div/0':120 'document':284,1075 'e.g':98 'edg':629 'edit':4,79,458,770,1044 'email':702,753,756 'enabl':1004 'env':695,699,750,759 'environ':745 'error':108,118,554,559,567,572,972,996,998 'everi':109 'exact':129 'exampl':803 'excel':24,70,89,110,297,324,352,355,363,382,384,390,553,600,658,680,723,812,1007,1066 'excel-specif':657 'exist':125,131,139,459 'existing.xlsx':470 'expens':809,817 'expir':982 'export':649,795 'extern':194 'fail':975,1003 'fals':387,946 'far':609 'far-right':608 'featur':660,1017 'ff0000':434 'ffff00':442 'file':13,62,138,198,391,460,1047,1067 'file.xlsx':356,364,664 'fill':437 'filter':788,924 'financi':146 'first':358,541 'fix':1001 'font':92,97,400,429,430 'format':16,132,210,212,223,233,243,247,426,625,654,782,961,962 'formula':15,65,107,117,174,262,274,291,298,325,420,516,526,545,570,574,655,669,773,828,906,926,995,1074 'formulabar':889 'formulabar-input':888 'found':989 'full':584 'function':775 'fy':612 'green':177 'guid':639 'guidelin':145,1050 'handl':603,973 'hardcod':160,285,293,306,310,320,1079 'header':228 'hello':411 'horizont':447 'identifi':997 'import':347,395,399,464,793 'includ':237,1081 'index':386 'industri':152 'industry-standard':151 'info':378 'input':161,887,890,892 'insert':846,868,902,915 'instead':280,299 'instruct':105 'interact':78,683 'javascript':877 'join':970 'json':556,563 'key':205,937,1084 'label':874,882,901,905,909,914,919,923 'larg':635 'librari':637 'libreoffic':517,538 'limit':1009,1031 'line':859,869 'link':183,195 'load':465,468,662 'locat':560 'login':710,721,974 'lookup':942 'macro':539,1035 'make':857 'manual':708,725 'map':588 'match':130,952,958 'maximum':1022 'mcp':688 'microsoft':701 'minim':1055 'minus':260 'mm':230 'mode':719 'model':111,147,585 'modifi':137,489 'modified.xlsx':514 'multipl':246,253,478 'must':112 'n/a':122 'name':123,366,482,488,893,1064 'nan':604 'need':207 'negat':254,632 'new':101,389,493,502,504,509,815,878,883 'newsheet':508 'none':367 'note':1082 'notifi':979 'number':166,209,255 'offset':596 'often':614 'one':244 'onedr':991,1014 'onlin':25,71,681,724,1008,1033,1039 'open':1042 'openpyxl':59,84,394,463,650 'openpyxl.styles':398 'openpyxl/pandas':10 'oper':646 'option':705,706,743 'otherwis':104 'output':90 'output.xlsx':385,457,531 'overrid':143 'panda':60,85,348,640 'parenthes':257 'part':80,674 'password':742,762,765 'patternfil':401,438 'pd':350 'pd.notna':606 'pd.read':354,362 'per':1027 'percentag':238,239 'pivot':29,74,784,836,847 'place':264 'playwright':27,73,687,729 'playwright-control':728 'power':1029 'preserv':124 'preview':374 'profession':91,96 'programmat':9,58,82 'provid':521 'pull':184 'python':304,308,346,392,461,529,1052 'queri':1030 'rang':845,931,938,949,954 're':984 're-authent':983 'read':342,351 'real':800 'real-tim':799 'recalcul':515,525,543 'recommend':711 'red':188 'ref':119 'refer':272,581,622,876 'rememb':594 'replac':668 'requir':86,518 'retri':976,1006 'return':555 'revenu':229,862,866 'rgb':156,169,179,190,201 'ribbon':895 'right':610 'role':897 'roman':102 'row':416,496,595,598,601,850,1023 'rule':263 'run':542 'sale':315,840 'sampl':580 'save':673,1002,1012 'scan':549 'scenario':164 'scenario-adjust':163 'script':523,534 'scripts/recalc.py':522,530 'search':990 'see':740 'select':638,843,865 'selector':875 'separ':268 'servic':752,761 'session':738,981 'set':536,700,751,760 'setup':690,716 'sheet':317,326,331,337,359,361,365,369,405,409,412,421,427,435,443,471,479,481,485,487,491,503,505,507,510,548,621,1028 'sheet.append':415 'sheet.column':451 'sheet.delete':498 'sheet.insert':495 'sheet1':626 'sheetnam':475 'show':861 'simpl':647 'skill':43 'skill-xlsx' 'solid':439 'sort':786,920 'sourc':287,1077 'source-rkz91' 'specif':659 'specifi':225 'spreadsheet':2,42,49,684,771,805 'standard':148,153 'start':440 'statist':380 'status':564 'string':215 'studi':127 'style':133,1049 'success':565 'suggest':1000 'sum':316,328,423,827,927,930,956,957 'sumif':953 'summari':573 'support':1037 'tab':896 'tabl':30,75,785,837,848 'tablist':898 'task':53 'templat':126,140 'test':577,628 'text':155,168,178,189,214,959,963,971 'time':100,801,978 'titl':872 'today':964 'tool':55 'topic-agent-skills' 'topic-agents-md' 'topic-ai-agents' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-developer-tools' 'topic-llm-tools' 'topic-mcp' 'topic-pm-tools' 'topic-product-management' 'topic-productivity' 'total':313,319,566,569,830 'tracker':810,818 'trend':863 'true':432,667,945 'two':7,44 'type':999 'unit':226 'unless':103 'unnecessari':1059 'usag':802 'use':34,93,221,232,256,270,275,290,296,323,519,623,717,735,790 'user':37,806,833,856,980 'valid':792 'valu':121,294,302,312,494,527,636,671,853,1080 'valuat':252 'variabl':746,1063 'verbos':1062 'verif':575 'verifi':618 'version':1021,1034,1040 'vertic':941 'via':26,72,686,692 'visual':779 'vlookup':936 'want':38 'warn':661 'wb':403,467,474,486 'wb.active':406,472 'wb.create':506 'wb.save':456,513 'wb.sheetnames':484 'width':450,454 'window':732 'without':739,1058 'work':47,476,685 'workbook':396,404,466,469,663,816,879,885,987 'worksheet':187 'world':414 'write':381,1054 'wrong':309 'x':250 'xlsm':1046 'xlsx':1,12,41,1045 'year':211 'yellow':199 'your-email':754 'your-email@outlook.com':703 'your-password':763 'zero':106,116,231,631","prices":[{"id":"0ead2636-e88d-43ac-aecf-5f0e6e3bba99","listingId":"264ca168-fd24-4a94-aa3f-dcd9a6c9f923","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"rkz91","category":"coco","install_from":"skills.sh"},"createdAt":"2026-05-18T13:21:44.683Z"}],"sources":[{"listingId":"264ca168-fd24-4a94-aa3f-dcd9a6c9f923","source":"github","sourceId":"rkz91/coco/xlsx","sourceUrl":"https://github.com/rkz91/coco/tree/main/skills/xlsx","isPrimary":false,"firstSeenAt":"2026-05-18T13:21:44.683Z","lastSeenAt":"2026-05-18T19:14:10.791Z"}],"details":{"listingId":"264ca168-fd24-4a94-aa3f-dcd9a6c9f923","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"rkz91","slug":"xlsx","github":{"repo":"rkz91/coco","stars":7,"topics":["agent-skills","agents-md","ai","ai-agents","claude-code","codex","cursor","developer-tools","llm-tools","mcp","pm-tools","product-management","productivity","prompt-engineering","workflow-automation"],"license":"mit","html_url":"https://github.com/rkz91/coco","pushed_at":"2026-04-26T01:51:27Z","description":"Open-source library of AI superpowers — 59 skills, 34 commands, 10 agents + 24 GSD subagents, 3 system bundles. An entire team, wherever your AI lives. Vendor-neutral across Claude Code, Cursor, Codex, and any AGENTS.md tool.","skill_md_sha":"a6224f7ef0dffc350b656cfcb32e45f2a2b5738f","skill_md_path":"skills/xlsx/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/rkz91/coco/tree/main/skills/xlsx"},"layout":"multi","source":"github","category":"coco","frontmatter":{"name":"xlsx","description":"Spreadsheet creation, editing, and analysis. Two approaches: Programmatic (openpyxl/pandas for .xlsx files with formulas, formatting, and data analysis) and Browser-based (Excel Online via Playwright for pivot tables, charts, and collaboration). Use when the user wants to create, read, edit, or fix .xlsx/.xlsm/.csv/.tsv files, or work with Excel Online."},"skills_sh_url":"https://skills.sh/rkz91/coco/xlsx"},"updatedAt":"2026-05-18T19:14:10.791Z"}}