Excel Row and Column Operations
Contents
[
Hide
]
Excel Row and Column Operations
Manage Excel row and column operations with AI-powered automation. Insert, delete, resize, hide/unhide Excel rows and columns for perfect spreadsheet layout management.
Available Tools
row_column_operations
- Excel row/column operations (insert, delete, resize, hide/unhide) with AI Excelrow_column_operations_batch
- Perform multiple Excel row/column operations in batch using Excel MCP
Single Operations
Insert Rows
{
"tool": "row_column_operations",
"parameters": {
"filepath": "reports/layout-test.xlsx",
"sheet_name": "Data",
"operation": "insert_rows",
"rows": "5",
"count": 2
}
}
Delete Columns
{
"tool": "row_column_operations",
"parameters": {
"filepath": "reports/cleanup.xlsx",
"sheet_name": "Sheet1",
"operation": "delete_columns",
"columns": "C:D"
}
}
Set Row Height
{
"tool": "row_column_operations",
"parameters": {
"filepath": "reports/formatted.xlsx",
"sheet_name": "Report",
"operation": "set_row_height",
"rows": "1",
"height": 30
}
}
Set Column Width
{
"tool": "row_column_operations",
"parameters": {
"filepath": "reports/formatted.xlsx",
"sheet_name": "Report",
"operation": "set_column_width",
"columns": "A:F",
"width": 15
}
}
Batch Operations
Comprehensive Layout Setup
{
"tool": "row_column_operations_batch",
"parameters": {
"filepath": "reports/professional-layout.xlsx",
"sheet_name": "Summary Report",
"operations": [
{
"operation": "set_row_height",
"rows": "3",
"height": 30
},
{
"operation": "set_row_height",
"rows": "4:6",
"height": 20
},
{
"operation": "set_column_width",
"columns": "C",
"width": 20
},
{
"operation": "set_column_width",
"columns": "D:G",
"width": 15
},
{
"operation": "auto_fit_rows",
"rows": "7:10"
}
]
}
}
Insert and Delete Operations
{
"tool": "row_column_operations_batch",
"parameters": {
"filepath": "reports/restructure.xlsx",
"sheet_name": "Sheet1",
"operations": [
{
"operation": "insert_rows",
"rows": "5",
"count": 2
},
{
"operation": "insert_columns",
"columns": "D",
"count": 1
},
{
"operation": "delete_rows",
"rows": "8:9"
}
]
}
}
Hide and Unhide Operations
{
"tool": "row_column_operations_batch",
"parameters": {
"filepath": "reports/visibility.xlsx",
"sheet_name": "Sheet1",
"operations": [
{
"operation": "hide_rows",
"rows": "15:16"
},
{
"operation": "hide_columns",
"columns": "H:I"
},
{
"operation": "unhide_rows",
"rows": "15"
},
{
"operation": "unhide_columns",
"columns": "H"
}
]
}
}
Auto-Fit Operations
{
"tool": "row_column_operations_batch",
"parameters": {
"filepath": "reports/auto-sized.xlsx",
"sheet_name": "Data",
"operations": [
{
"operation": "auto_fit_columns",
"columns": "A:F"
},
{
"operation": "auto_fit_rows",
"rows": "1:20"
}
]
}
}
Operation Types Reference
Insert Operations
insert_rows
- Insert new rows at specified positioninsert_columns
- Insert new columns at specified position
Delete Operations
delete_rows
- Delete specified rowsdelete_columns
- Delete specified columns
Resize Operations
set_row_height
- Set specific row height in pointsset_column_width
- Set specific column width in charactersauto_fit_rows
- Auto-fit rows to content heightauto_fit_columns
- Auto-fit columns to content width
Visibility Operations
hide_rows
- Hide specified rowsunhide_rows
- Show hidden rowshide_columns
- Hide specified columnsunhide_columns
- Show hidden columns
Range Specifications
Row Ranges
"1"
- Single row (row 1)"1:3"
- Range of rows (rows 1 to 3)"5:10"
- Multiple consecutive rows
Column Ranges
"A"
- Single column (column A)"A:C"
- Range of columns (columns A to C)"D:F"
- Multiple consecutive columns
Advanced Examples
Report Header Setup
{
"tool": "row_column_operations_batch",
"parameters": {
"filepath": "reports/header-setup.xlsx",
"sheet_name": "Report",
"operations": [
{
"operation": "set_row_height",
"rows": "1:2",
"height": 35
},
{
"operation": "set_column_width",
"columns": "A",
"width": 25
},
{
"operation": "set_column_width",
"columns": "B:E",
"width": 12
},
{
"operation": "set_column_width",
"columns": "F",
"width": 18
}
]
}
}
Data Table Layout
{
"tool": "row_column_operations_batch",
"parameters": {
"filepath": "reports/data-table.xlsx",
"sheet_name": "Data",
"operations": [
{
"operation": "insert_rows",
"rows": "1",
"count": 1
},
{
"operation": "set_row_height",
"rows": "1",
"height": 25
},
{
"operation": "auto_fit_columns",
"columns": "A:J"
},
{
"operation": "set_row_height",
"rows": "2:100",
"height": 18
}
]
}
}
Presentation Layout
{
"tool": "row_column_operations_batch",
"parameters": {
"filepath": "reports/presentation.xlsx",
"sheet_name": "Summary",
"operations": [
{
"operation": "hide_columns",
"columns": "B:C"
},
{
"operation": "hide_rows",
"rows": "10:15"
},
{
"operation": "set_column_width",
"columns": "A",
"width": 30
},
{
"operation": "set_column_width",
"columns": "D:G",
"width": 15
}
]
}
}
Measurement Guidelines
Row Heights (Points)
15
- Default row height20
- Slightly taller for readability25
- Good for headers30
- Large headers40
- Extra large for titles
Column Widths (Characters)
8
- Narrow columns (dates, codes)12
- Standard data columns15
- Medium text columns20
- Wide text columns25
- Extra wide for descriptions30
- Very wide for long text
Best Practices
- Header Sizing: Make headers taller and wider for emphasis
- Data Consistency: Use consistent row heights for data rows
- Auto-Fit: Use auto-fit for dynamic content sizing
- Hide Unused: Hide empty rows/columns for cleaner appearance
- Logical Grouping: Group related resize operations in batches
Common Patterns
Report Setup Pattern
- Insert title rows at top
- Set header row height
- Auto-fit data columns
- Set standard data row height
- Hide unused areas
Data Import Pattern
- Insert rows for new data
- Auto-fit columns to content
- Standardize row heights
- Hide calculation columns
Presentation Pattern
- Hide detail rows/columns
- Enlarge summary areas
- Set presentation-friendly dimensions
- Show only relevant data
Error Handling
Invalid Row Range
{
"tool": "row_column_operations",
"parameters": {
"filepath": "test.xlsx",
"sheet_name": "Sheet1",
"operation": "set_row_height",
"rows": "0",
"height": 20
}
}
Result: Error - row numbers start from 1
Invalid Column Range
{
"tool": "row_column_operations",
"parameters": {
"filepath": "test.xlsx",
"sheet_name": "Sheet1",
"operation": "set_column_width",
"columns": "ZZ",
"width": 10
}
}
Result: May succeed but beyond typical usage
Missing Required Parameters
{
"tool": "row_column_operations",
"parameters": {
"filepath": "test.xlsx",
"sheet_name": "Sheet1",
"operation": "set_row_height",
"rows": "1"
}
}
Result: Error - height parameter required