Getting started with macros
ONLYOFFICE macros are lightweight JavaScript scripts that run directly inside documents using the Office JavaScript API. No installation required - write the code, run it, done.
If you prefer to start coding right away, go directly to the quick start guide.
What you can build
Automate repetitive tasks without leaving the editor.
Perfect for:
- One-click formatting (Reset text properties - quickly reset text to default formatting)
- Batch operations (Remove empty tables - remove all empty tables across the document)
- Custom calculations (Find weighted average - calculate a weighted average on the selected range)
- Document cleanup (Remove empty paragraphs - remove blank paragraphs across the entire presentation)
Development profile:
- Time: 30 mins - 2 hours | Skill: Beginner | Tech: JavaScript basics
- Distribution: Copy-paste code or embed in document templates
Troubleshooting
Macro doesn't run:
- Check macros are enabled in View → Macros
- Look for syntax errors in the macro editor
- Verify API method names are correct
Unexpected results:
- Add
console.log()statements for debugging - Test each step individually
- Check document state before running
Need more help?
- Developer Forum - Community support
- Stack Overflow - Q&A archive
Resources
- Macro examples - Ready-to-use scripts
- Office API reference - Complete API documentation
- Writing macros - Macro development guide
- FAQ - Frequently asked questions
Next steps
Also available: Plugins | Custom AI tools