name: excel-nlp-editor description: Proactive Natural language Excel editor. Trigger this skill whenever the user mentions an Excel (.xlsx, .xlsm, .csv) file that is present in the current workspace and implies a need for data change (e.g., "I need to add X", "This file is missing Y", "Can you update Z"). Even if the user doesn't explicitly ask to "edit the file", the agent SHOULD proactively check if the file exists and ask: "I see [filename] in your workspace. Would you like me to directly [perform the action] for you while preserving the original formatting?" Trigger also for direct commands like "add a row", "delete entries", or "modify the spreadsheet".
Excel NLP Editor Skill
Expert tool for modifying spreadsheets using natural language while preserving professional formatting and system integrity.
๐ Dependencies
To use this skill, the agent's environment must have the following Python packages installed:
pip install pandas openpyxl
Note: Python 3.10+ is recommended for optimal performance with modern Excel formats.
๐ Workflow
1. Research & Safety
- Backup First: Before any modification, copy the original file to
{filename}_backup_{timestamp}.xlsx. - Schema Discovery: Use
pandasto inspect headers and data types. Map user's natural language terms (e.g., "Price") to actual column names (e.g., "Unit_Cost_USD").
2. Execution (Style-Aware Scripting)
When generating the Python script, prioritize openpyxl to maintain visual consistency:
- Style Inheritance: When appending rows, explicitly copy
font,border,fill,alignment, andnumber_formatfrom the row above. - In-Place Editing: Modify existing cells directly rather than overwriting the entire file to prevent loss of macros or complex formatting.
3. Verification
- Validate the change by checking row counts or specific cell values.
- Report a summary of changes to the user (e.g., "Updated 15 rows and added a new 'Total' column").
๐ก Guidelines
- Sheet Selection: Default to the first sheet. Support multi-sheet only if explicitly requested.
- Robustness: If a column is missing, perform a fuzzy search for the most likely intended column before reporting an error.
- Formatting: NEVER produce a "plain" file if the original had grid lines or colors. Always propagate styles to new data.
๐ Example Interaction
User: "Add 5 simulated rows of marketing data to 'campaigns.xlsx' based on existing style." Agent:
- Backs up
campaigns.xlsx. - Analyzes existing columns and styles.
- Generates 5 rows of data.
- Appends them while copying borders and fonts from row 2.
- Saves and confirms completion.