Skip to main content

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:

Development profile:

  • Time: 30 mins - 2 hours | Skill: Beginner | Tech: JavaScript basics
  • Distribution: Copy-paste code or embed in document templates

Browse all macro examples

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?

Resources

Next steps

Also available: Plugins | Custom AI tools