By Sagar Shankaran, Founder of CallSphere
Practical examples of automating Microsoft Office applications with UFO — from Excel data manipulation and Word document formatting to Outlook email workflows, with multi-step task descriptions and result verification.
Key takeaways
The quality of UFO's automation depends heavily on how you describe the task. Vague instructions lead to unpredictable behavior. Specific, step-oriented descriptions produce reliable results.
Here are principles for writing good UFO task descriptions:
python -m ufo --task "In the open Excel workbook, go to Sheet1. Enter the following data starting at cell A1: headers are Name, Revenue, Quarter. Row 2 is Acme Corp, 150000, Q1. Row 3 is Beta Inc, 230000, Q1. Row 4 is Gamma LLC, 89000, Q1. Then select the header row and make it bold. Auto-fit all column widths."
This task exercises multiple action types: cell navigation, text entry, selection, formatting toolbar interaction, and menu access.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
flowchart LR
INPUT(["User intent"])
PARSE["Parse plus<br/>classify"]
PLAN["Plan and tool<br/>selection"]
AGENT["Agent loop<br/>LLM plus tools"]
GUARD{"Guardrails<br/>and policy"}
EXEC["Execute and<br/>verify result"]
OBS[("Trace and metrics")]
OUT(["Outcome plus<br/>next action"])
INPUT --> PARSE --> PLAN --> AGENT --> GUARD
GUARD -->|Pass| EXEC --> OUT
GUARD -->|Fail| AGENT
AGENT --> OBS
style AGENT fill:#4f46e5,stroke:#4338ca,color:#fff
style GUARD fill:#f59e0b,stroke:#d97706,color:#1f2937
style OBS fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
style OUT fill:#059669,stroke:#047857,color:#fff
python -m ufo --task "In the open Excel spreadsheet, add a SUM formula in cell B5 that totals B2 through B4. Format B5 as currency with no decimal places. Then select the range A1 to B4 and insert a bar chart. Move the chart below the data table."
python -m ufo --task "In Excel, select the range B2 to B100. Apply conditional formatting so that cells with values greater than 100000 have a green background and cells with values less than 50000 have a red background."
You can also invoke UFO from Python scripts for batch automation:
import subprocess
import json
def run_ufo_task(task: str, timeout: int = 300) -> dict:
"""Run a UFO task and return the result."""
result = subprocess.run(
["python", "-m", "ufo", "--task", task],
capture_output=True,
text=True,
timeout=timeout,
cwd="C:\\path\\to\\UFO"
)
return {
"returncode": result.returncode,
"stdout": result.stdout,
"stderr": result.stderr,
"success": result.returncode == 0
}
# Excel automation
excel_tasks = [
"In Excel, open the file C:\\Reports\\Q1_Sales.xlsx",
"In Excel, select all data in Sheet1 and sort by column B in descending order",
"In Excel, create a pivot table from the data in Sheet1 summarizing Revenue by Quarter",
]
for task in excel_tasks:
print(f"Running: {task}")
result = run_ufo_task(task)
if not result["success"]:
print(f"Task failed: {result['stderr']}")
break
print(f"Completed in output: {result['stdout'][-200:]}")
python -m ufo --task "In Microsoft Word, create a new document. Set the title to Quarterly Business Review. Add three headings: Executive Summary, Financial Highlights, and Next Steps. Under Executive Summary, type a placeholder paragraph. Save the document as QBR_Q1_2026.docx on the Desktop."
python -m ufo --task "In the open Word document, select all text and change the font to Calibri 11pt. Change the title to Heading 1 style. Change all section headings to Heading 2 style. Add page numbers in the footer."
python -m ufo --task "In Outlook, create a new email. Set the To field to finance@company.com. Set the Subject to Q1 Sales Report Ready. In the body type: Hi team, the Q1 sales report has been finalized and is available in the shared drive. Please review by end of week. Best regards. Then click Send."
The most powerful UFO use case is chaining actions across applications:
def excel_to_email_workflow():
"""Extract data from Excel and send it via Outlook."""
# Phase 1: Excel data extraction
run_ufo_task(
"In Excel, open C:\\Reports\\Q1_Sales.xlsx. "
"Go to the Summary sheet. Select cells A1 through D10. "
"Copy the selection to clipboard."
)
# Phase 2: Email composition
run_ufo_task(
"In Outlook, create a new email. "
"Set To to finance@company.com and CC to cfo@company.com. "
"Set Subject to Q1 Sales Summary. "
"In the body, type 'Please find the Q1 sales summary below:' "
"then press Enter twice and paste the clipboard contents. "
"Click Send."
)
print("Excel-to-Email workflow completed")
UFO is designed for native Windows desktop applications, not browser-based Office 365. For web-based Office, browser automation tools like Playwright or Selenium are more appropriate. However, you could use UFO to automate a browser window if the browser exposes proper UIA elements.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
COM automation via win32com or VBA macros is more reliable and faster for repetitive, well-defined Office tasks. UFO is better for tasks that are difficult to script programmatically — such as interacting with complex dialog boxes, formatting charts by visual appearance, or handling dynamic content layouts.
If the application crashes, UFO's next screenshot capture will show a different state (perhaps a recovery dialog or a missing window). The HostAgent will detect that the expected application is no longer available and report a task failure. You should implement retry logic in your orchestration script.
#OfficeAutomation #ExcelAutomation #WordAutomation #OutlookAutomation #MicrosoftUFO #NaturalLanguageUI #AIWorkflow #DesktopRPA

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
Understand Microsoft UFO's known limitations with complex UI controls, high-DPI displays, and time-sensitive interactions, along with practical workarounds and hybrid strategies for production reliability.
Master cross-application automation with Microsoft UFO by building workflows that transfer data between Excel, Outlook, browsers, and desktop applications through coordinated multi-app sequences.
Step-by-step guide to installing Microsoft UFO, configuring API keys, setting up the configuration files, and running your first automated Windows task with natural language.
Explore how UFO captures, annotates, and sends Windows application screenshots to GPT-4V for UI element detection, control identification, and intelligent action mapping at each automation step.
Learn what Microsoft UFO is, how its dual-agent architecture combines HostAgent and AppAgent with GPT-4V vision to translate natural language requests into Windows UI actions automatically.
Understand when to use Microsoft UFO for Windows desktop automation versus browser tools like Playwright or Selenium, with use cases for legacy apps, native software, and hybrid approaches.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI