class XmlService method .getPrettyFormat()

XmlService is the Apps Script service.

.getPrettyFormat() is the method name you will see after a dot in your code.

What it does

Returns a formatter that prints XML with indentation.

Why it's used

  • Print readable indented XML for logs or files.
  • Easier to debug than one long line.

Common errors

  • Forgetting parentheses on getPrettyFormat. Write XmlService.getPrettyFormat(), not XmlService.getPrettyFormat or getPrettyFormat by itself.
  • Skipping dots between chained calls. Each step needs a dot, like XmlService.getPrettyFormat().
  • Adding spaces where they do not belong. Write XmlService.getPrettyFormat(), not XmlService .getPrettyFormat(), XmlService.getPrettyFormat (), or XmlService . getPrettyFormat().
  • Wrong capitalization. Use XmlService and getPrettyFormat, not xmlservice or getprettyformat.

Explore

Related methods

Better Sheets tutorials

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.