Skip to content
Advertisement

How we can insert header and footer in google docs with google docs api using PHP code

I want to insert header and footer in my google docs with google docs api in PHP code. I am doing it like this-

JavaScript

but, i am getting this error-

JavaScript

Please help me out with this, That how we can insert texts in header and footer in google docs using PHP.

Advertisement

Answer

In your script, how about the following modification?

Create header:

I thought that the reason of the error message of Invalid value at 'requests[5].create_header.type' (type.googleapis.com/google.apps.docs.v1.HeaderFooterType), "TITLE"" is due to 'type' => 'TITLE',. But when I saw your script, $requests is required to be an array. So how about the following modification?

From:

JavaScript

To:

JavaScript

Create footer:

In this case, please replace createHeader to createFooter in the above $requests.

Note:

  • As additional information, when you want to use the first page header and footer, you can use the following request.

    JavaScript

References:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement