class XmlService method .createElement()

XmlService is the Apps Script service.

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

What it does

Creates a new XML element with a tag name.

Why it's used

  • Add nodes when building XML by hand.
  • Structure nested data for an integration.

Common errors

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

Explore

Related methods

Better Sheets tutorials

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