Search code examples
google-docs-api

Google docs api insert column break


How to insert column break using google docs api v1? There are methods like insertPageBreak and insertSectionBreak but nothing for column break.


Solution

  • Unfortunately, what you want cannot be achieved.

    When updating a Google Doc, the only options are indeed only the ones to insert a page break or a section break.

    However, the ParagraphElement contains a ColumnBreak element. So when creating a document using the below request, you can specify directly where you would like to place the ColumnBreak

    Request

    POST https://docs.googleapis.com/v1/documents
    

    Body

    "paragraph": {
        "elements": [{
            "startIndex": start_index,
            "endIndex": end_index,
            "columnBreak": {
                "textStyle": {}
            }
        }]
    }
    

    What you can do in this situation is to file a request on Google's Issue Tracker here and provide all the necessary details.

    Reference