Skip to content

3bslam/excel-controller-openclaw-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

excel-controller — OpenClaw Skill

RPA-style Excel automation for AI agents. Give your OpenClaw agent full control over the live Excel application — open workbooks, write data, create dashboards, run macros, and do everything a human can do, but faster.

License: MIT OpenClaw Platform


What This Skill Does

Unlike file-based libraries (openpyxl, pandas) that manipulate .xlsx files on disk, excel-controller drives the running Excel application in real time — the same way a human would click and type:

  • Open, create, save, and close workbooks
  • Navigate sheets, select cells, read and write data
  • Write formulas that Excel calculates natively
  • Format cells: fonts, colors, borders, number formats, alignment
  • Create charts: bar, line, pie, combo, radar, scatter
  • Build pivot tables with custom fields and aggregations
  • Add conditional formatting, data validation, and dropdowns
  • Run existing VBA macros or inject and execute new ones at runtime
  • Build complete multi-sheet dashboards with KPI cards
  • Export sheets to PDF
  • Sort, filter, and auto-fit columns

Platform support:

Platform Engine Package
Windows COM Automation (win32com.client) pywin32
macOS xlwings bridge xlwings
Linux Not supported Use excel-master instead

Prerequisites

  • Microsoft Excel (or Microsoft 365) must be installed
  • Python 3.8+

Installation

1. Clone or download

git clone https://github.com/3bslam/excel-controller-openclaw-skill.git

2. Copy the skill into OpenClaw

# Per-workspace (recommended)
cp -r excel-controller-openclaw-skill/excel-controller \
      ~/.openclaw/workspace/skills/excel-controller

# Or shared across all agents
cp -r excel-controller-openclaw-skill/excel-controller \
      ~/.openclaw/skills/excel-controller

3. Install Python dependencies

# Windows (full COM automation — recommended)
pip install pywin32

# macOS (xlwings bridge)
pip install xlwings

# Optional: data manipulation helpers
pip install pandas openpyxl

4. (Windows only) Enable VBA trust for macro injection

If you want the agent to inject and run VBA code at runtime:

Excel → File → Options → Trust Center → Trust Center Settings → Macro Settings → ☑ Trust access to the VBA project object model

5. Reload OpenClaw

/new
# or
openclaw gateway restart

Usage

Once installed, just describe what you want in natural language:

"Open Excel and create a sales dashboard with bar charts and KPI cards"
"Open my quarterly report and add a pivot table by region"
"Format the header row — dark blue background, white bold text"
"Create a line chart showing the revenue trend across Q1–Q4"
"Run the CalculateAll macro in this workbook"
"Add conditional formatting: green above 1000, red below 500"
"Export the Dashboard sheet to PDF"

The agent uses scripts/excel_safe.py automatically to manage the COM session safely.


Skill Configuration (optional)

In ~/.openclaw/openclaw.json:

{
  "skills": {
    "entries": {
      "excel_controller": {
        "enabled": true
      }
    }
  }
}

Repository Structure

excel-controller-openclaw-skill/
├── README.md                       # This file
├── LICENSE                         # MIT
├── .gitignore
└── excel-controller/
    ├── SKILL.md                    # Skill definition (frontmatter + full reference)
    ├── README.md                   # Quick-start guide
    └── scripts/
        └── excel_safe.py           # COM session manager + formatting helpers

scripts/excel_safe.py

A production-ready helper that provides:

Export Description
excel_session(visible, display_alerts) Context manager — handles COM init, Excel launch, and guaranteed cleanup
rgb(r, g, b) Converts RGB to Excel's BGR integer format
COLORS Professional color palette (header blue, input blue, positive green, etc.)
format_header(ws, range, ...) One-call header formatting
format_currency(ws, range, fmt) Apply currency number format
format_percentage(ws, range, decimals) Apply percentage format
add_borders(ws, range, weight, color) Add borders to a range
auto_fit(ws) Auto-fit all columns and rows
write_data_block(ws, start_cell, data) Bulk-write a 2D list (much faster than cell-by-cell)
disable_updates(excel) Turn off screen update + manual calc for performance
enable_updates(excel) Re-enable screen update + auto calc

Example:

from excel_safe import excel_session, write_data_block, format_header, rgb

with excel_session(visible=True) as excel:
    wb = excel.Workbooks.Add()
    ws = wb.ActiveSheet
    ws.Name = "Sales"

    headers = [["Product", "Q1", "Q2", "Q3", "Q4"]]
    data = [
        ["Product A", 15000, 18000, 17500, 21000],
        ["Product B", 12000, 13500, 14200, 16800],
    ]

    write_data_block(ws, "A1", headers + data)
    format_header(ws, "A1:E1")

    wb.SaveAs(r"C:\Users\me\Documents\sales.xlsx")

excel-controller vs excel-master

Feature excel-controller excel-master
Controls live Excel app
Requires Excel installed ❌ (uses LibreOffice)
Real-time formula recalc ✅ Native ⚠️ LibreOffice headless
VBA macros ✅ Full
Pivot tables ✅ Native
Charts ✅ Full Excel ⚠️ openpyxl (limited)
Works on Linux
Headless / server use ⚠️ Background mode
Speed on large files ⚠️ App overhead ✅ Fast

Use excel-controller when you need the full power of Excel — dashboards, pivot tables, VBA, real-time formulas, and interactive work on Windows/macOS.

Use excel-master when you need to create or process files on a server, in CI/CD, or on Linux.


Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-improvement)
  3. Commit your changes
  4. Open a Pull Request

For bug reports and feature requests, please open an issue.


Community

This skill is a community contribution to the OpenClaw ecosystem. If you build something useful with it, share it — open an issue or discussion to show what you've made.


License

MIT — free to use, modify, and distribute.

About

RPA-style Excel automation skill for OpenClaw AI agents — control live Excel via win32com/xlwings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages