Files
sbroenne__mcp-server-excel/examples/batch-mode-demo.sh
T
Copilot b156c6af2d Add batch mode to CLI for RPA workflows (75-90% faster multi-operation execution) (#153)
* Initial plan

* Add basic batch commands to CLI (begin, commit, list)

Co-authored-by: sbroenne <3026464+sbroenne@users.noreply.github.com>

* Add batch-id parameter support to CLI commands with CommandHelper

Co-authored-by: sbroenne <3026464+sbroenne@users.noreply.github.com>

* Add batch mode documentation to CLI README

Co-authored-by: sbroenne <3026464+sbroenne@users.noreply.github.com>

* Add batch mode example scripts and documentation

Co-authored-by: sbroenne <3026464+sbroenne@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sbroenne <3026464+sbroenne@users.noreply.github.com>
2025-11-09 14:51:17 +01:00

60 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Batch Mode Example Script for ExcelMcp.CLI
# This demonstrates the new batch support feature for RPA workflows
# NOTE: Requires Windows + Excel installed
set -e
echo "=== ExcelMcp.CLI Batch Mode Demo ==="
echo ""
# Create a test Excel file
echo "1. Creating test workbook..."
excelcli create-empty test-batch.xlsx
# Start batch session
echo ""
echo "2. Starting batch session..."
BATCH_ID=$(excelcli batch-begin test-batch.xlsx | grep "Batch ID:" | awk '{print $3}')
echo " Batch ID: $BATCH_ID"
# Perform multiple operations using the same batch
echo ""
echo "3. Performing multiple operations (using same Excel instance)..."
echo " - Creating sheets..."
excelcli sheet-create test-batch.xlsx "Sales" --batch-id "$BATCH_ID"
excelcli sheet-create test-batch.xlsx "Customers" --batch-id "$BATCH_ID"
excelcli sheet-create test-batch.xlsx "Products" --batch-id "$BATCH_ID"
echo " - Listing sheets..."
excelcli sheet-list test-batch.xlsx --batch-id "$BATCH_ID"
echo " - Listing Power Queries..."
excelcli pq-list test-batch.xlsx --batch-id "$BATCH_ID"
# List active batches
echo ""
echo "4. Listing active batches..."
excelcli batch-list
# Commit the batch
echo ""
echo "5. Committing batch (saving all changes)..."
excelcli batch-commit "$BATCH_ID"
echo ""
echo "6. Verifying changes were saved..."
excelcli sheet-list test-batch.xlsx
echo ""
echo "=== Demo Complete ==="
echo ""
echo "Benefits of batch mode:"
echo "- 75-90% faster than individual operations"
echo "- Single Excel instance for all operations"
echo "- Explicit control over save/discard"
echo ""
echo "Cleanup: rm test-batch.xlsx"