Skip to content
OpenSmartRoute
Skillv1.0.0

xlsx

Working with Excel files programmatically.

by bobmatnyc(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from bobmatnyc/claude-mpm-skills (universal/data/xlsx/SKILL.md) via skills.sh. Install upstream with npx skills add bobmatnyc/claude-mpm-skills --skill xlsx. Copyright stays with the author.

Excel/XLSX Manipulation

Working with Excel files programmatically.

Python (openpyxl)

Reading Excel

from openpyxl import load_workbook

wb = load_workbook('data.xlsx')
ws = wb.active  # Get active sheet

# Read cell
value = ws['A1'].value

# Iterate rows
for row in ws.iter_rows(min_row=2, values_only=True):
    print(row)

Writing Excel

from openpyxl import Workbook

wb = Workbook()
ws = wb.active
ws.title = "Data"

# Write data
ws['A1'] = 'Name'
ws['B1'] = 'Age'
ws.append(['John', 30])
ws.append(['Jane', 25])

wb.save('output.xlsx')

Formatting

from openpyxl.styles import Font, PatternFill

# Bold header
ws['A1'].font = Font(bold=True)

# Background color
ws['A1'].fill = PatternFill(start_color="FFFF00", fill_type="solid")

# Number format
ws['B2'].number_format = '0.00'  # Two decimals

Formulas

# Add formula
ws['C2'] = '=A2+B2'

# Sum column
ws['D10'] = '=SUM(D2:D9)'

Python (pandas)

Reading Excel

import pandas as pd

# Read sheet
df = pd.read_excel('data.xlsx', sheet_name='Sheet1')

# Read multiple sheets
dfs = pd.read_excel('data.xlsx', sheet_name=None)

Writing Excel

# Write DataFrame
df.to_excel('output.xlsx', index=False)

# Multiple sheets
with pd.ExcelWriter('output.xlsx') as writer:
    df1.to_excel(writer, sheet_name='Sheet1')
    df2.to_excel(writer, sheet_name='Sheet2')

Data Transformation

# Filter
filtered = df[df['Age'] > 25]

# Group by
grouped = df.groupby('Department')['Salary'].mean()

# Pivot
pivot = df.pivot_table(values='Sales', index='Region', columns='Product')

JavaScript (xlsx)

import XLSX from 'xlsx';

// Read file
const workbook = XLSX.readFile('data.xlsx');
const sheetName = workbook.SheetNames[0];
const worksheet = workbook.Sheets[sheetName];

// Convert to JSON
const data = XLSX.utils.sheet_to_json(worksheet);

// Write file
const newWorksheet = XLSX.utils.json_to_sheet(data);
const newWorkbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(newWorkbook, newWorksheet, 'Data');
XLSX.writeFile(newWorkbook, 'output.xlsx');

Common Operations

CSV to Excel

import pandas as pd

df = pd.read_csv('data.csv')
df.to_excel('data.xlsx', index=False)

Excel to CSV

df = pd.read_excel('data.xlsx')
df.to_csv('data.csv', index=False)

Merging Excel Files

dfs = []
for file in ['file1.xlsx', 'file2.xlsx', 'file3.xlsx']:
    df = pd.read_excel(file)
    dfs.append(df)

combined = pd.concat(dfs, ignore_index=True)
combined.to_excel('merged.xlsx', index=False)

Remember

  • Close workbooks after use
  • Handle large files in chunks
  • Validate data before writing
  • Use pandas for data analysis, openpyxl for formatting

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/bobmatnyc-claude-mpm-skills-xlsx/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

bobmatnyc-claude-mpm-skills-xlsx.ocm.jsonjson
{
  "ocm": "1",
  "id": "bobmatnyc-claude-mpm-skills-xlsx",
  "kind": "skill",
  "name": "xlsx",
  "description": "Working with Excel files programmatically.",
  "publisher": "bobmatnyc",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "excel",
      "xlsx",
      "spreadsheet",
      "data",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Working with Excel files programmatically."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/bobmatnyc/claude-mpm-skills",
      "path": "universal/data/xlsx/SKILL.md",
      "ref": "HEAD",
      "url": "https://www.skills.sh/bobmatnyc/claude-mpm-skills/xlsx",
      "key": "bobmatnyc/claude-mpm-skills/universal/data/xlsx/SKILL.md"
    }
  },
  "instructions": "# Excel/XLSX Manipulation\n\nWorking with Excel files programmatically.\n\n## Python (openpyxl)\n\n### Reading Excel\n```python\nfrom openpyxl import load_workbook\n\nwb = load_workbook('data.xlsx')\nws = wb.active  # Get active sheet\n\n# Read cell\nvalue = ws['A1'].value\n\n# Iterate rows\nfor row in ws.iter_rows(min_row=2, values_only=True):\n    print(row)\n```\n\n### Writing Excel\n```python\nfrom openpyxl import Workbook\n\nwb = Workbook()\nws = wb.active\nws.title = \"Data\"\n\n# Write data\nws['A1'] = 'Name'\nws['B1'] = 'Age'\nws.append(['John', 30])\nws.append(['Jane', 25])\n\nwb.save('output.xlsx')\n```\n\n### Formatting\n`",
  "cost": {
    "context_tokens": 698
  }
}

Fetch it by URL: GET /api/v1/registry/bobmatnyc-claude-mpm-skills-xlsx/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.