Google Apps Script API
    Preparing search index...

    An element representing a table. A Table may only contain TableRow elements. For more information on document structure, see the guide to extending Google Docs.

    When creating a Table that contains a large number of rows or cells, consider building it from a string array, as shown in the following example.

    var body = DocumentApp.getActiveDocument().getBody();
    
    // Create a two-dimensional array containing the cell contents.
    var cells = [
      ['Row 1, Cell 1', 'Row 1, Cell 2'],
      ['Row 2, Cell 1', 'Row 2, Cell 2']
    ];
    
    // Build a table from the array.
    body.appendTable(cells);
    
    interface Table {
        appendTableRow(): GoogleAppsScript.Document.TableRow;
        appendTableRow(
            tableRow: GoogleAppsScript.Document.TableRow,
        ): GoogleAppsScript.Document.TableRow;
        asBody(): GoogleAppsScript.Document.Body;
        asDate(): GoogleAppsScript.Document.Date;
        asEquation(): GoogleAppsScript.Document.Equation;
        asEquationFunction(): EquationFunction;
        asEquationFunctionArgumentSeparator(): EquationFunctionArgumentSeparator;
        asEquationSymbol(): EquationSymbol;
        asFooterSection(): FooterSection;
        asFootnote(): GoogleAppsScript.Document.Footnote;
        asFootnoteSection(): FootnoteSection;
        asHeaderSection(): HeaderSection;
        asHorizontalRule(): GoogleAppsScript.Document.HorizontalRule;
        asInlineDrawing(): InlineDrawing;
        asInlineImage(): InlineImage;
        asListItem(): GoogleAppsScript.Document.ListItem;
        asPageBreak(): GoogleAppsScript.Document.PageBreak;
        asParagraph(): GoogleAppsScript.Document.Paragraph;
        asPerson(): GoogleAppsScript.Document.Person;
        asRichLink(): RichLink;
        asTable(): GoogleAppsScript.Document.Table;
        asTableCell(): GoogleAppsScript.Document.TableCell;
        asTableOfContents(): GoogleAppsScript.Document.TableOfContents;
        asTableRow(): GoogleAppsScript.Document.TableRow;
        asText(): GoogleAppsScript.Document.Text;
        clear(): GoogleAppsScript.Document.Table;
        copy(): GoogleAppsScript.Document.Table;
        editAsText(): GoogleAppsScript.Document.Text;
        findElement(elementType: ElementType, from?: RangeElement): RangeElement;
        findText(searchPattern: string, from?: RangeElement): RangeElement;
        getAttributes(): any;
        getBorderColor(): string;
        getBorderWidth(): number;
        getCell(
            rowIndex: number,
            cellIndex: number,
        ): GoogleAppsScript.Document.TableCell;
        getChild(childIndex: number): GoogleAppsScript.Document.Element;
        getChildIndex(child: GoogleAppsScript.Document.Element): number;
        getColumnWidth(columnIndex: number): number;
        getLinkUrl(): string;
        getNextSibling(): GoogleAppsScript.Document.Element;
        getNumChildren(): number;
        getNumRows(): number;
        getParent(): ContainerElement;
        getPreviousSibling(): GoogleAppsScript.Document.Element;
        getRow(rowIndex: number): GoogleAppsScript.Document.TableRow;
        getText(): string;
        getTextAlignment(): TextAlignment;
        getType(): ElementType;
        insertTableRow(
            childIndex: number,
            tableRow?: GoogleAppsScript.Document.TableRow,
        ): GoogleAppsScript.Document.TableRow;
        isAtDocumentEnd(): boolean;
        merge(): GoogleAppsScript.Document.Element;
        removeChild(
            child: GoogleAppsScript.Document.Element,
        ): GoogleAppsScript.Document.Table;
        removeFromParent(): GoogleAppsScript.Document.Table;
        removeRow(rowIndex: number): GoogleAppsScript.Document.TableRow;
        replaceText(
            searchPattern: string,
            replacement: string,
        ): GoogleAppsScript.Document.Element;
        setAttributes(attributes: any): GoogleAppsScript.Document.Table;
        setBorderColor(color: string): GoogleAppsScript.Document.Table;
        setBorderWidth(width: number): GoogleAppsScript.Document.Table;
        setColumnWidth(
            columnIndex: number,
            width: number,
        ): GoogleAppsScript.Document.Table;
        setLinkUrl(url: string): GoogleAppsScript.Document.Table;
        setTextAlignment(
            textAlignment: TextAlignment,
        ): GoogleAppsScript.Document.Table;
    }

    Hierarchy (View Summary)

    Index

    Methods