class DocumentApp method .appendTable()

DocumentApp is the Apps Script service.

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

What it does

Adds a new table to the end of the document.

Why it's used

  • Drop a pricing or inventory table into a report doc.
  • Export sheet rows as a formatted table in one step.

Common errors

  • Forgetting parentheses on appendTable. Write DocumentApp.appendTable(), not DocumentApp.appendTable or appendTable by itself.
  • Skipping dots between chained calls. Each step needs a dot, like DocumentApp.getActiveDocument().getBody().appendTable().
  • Adding spaces where they do not belong. Write DocumentApp.appendTable(), not DocumentApp .appendTable(), DocumentApp.appendTable (), or DocumentApp . appendTable().
  • Wrong capitalization. Use DocumentApp and appendTable, not documentapp or appendtable.

Explore

Related methods

  • .appendParagraph()

    Adds a new paragraph to the end of the document.

  • .create()

    Creates a new blank Google Doc.

  • .setText()

    Replaces the text content of a document element.

  • .getBody()

    Returns the main body section of the document for editing.

  • .openById()

    Opens an existing Google Doc by its file ID.

Better Sheets tutorials

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

Related blog posts

Written guides about DocumentApp.appendTable().

Browse the blog