Hey everyone! I’m trying to figure out how to make the page numbers in my Google Doc start on the third page instead of the second. Right now, they’re showing up on the Table of Contents page, but I want them to begin in the actual content section.
I tried a workaround by making a template with three blank pages at the start. On the third page, I put a footer and set the page number to 1. But it didn’t work out like I hoped.
Does anyone know if there’s a way to do this with the Google Docs API? I’m not sure if it’s even possible or if I’m missing something obvious. Any tips or tricks would be super helpful!
Here’s a quick example of what I tried in code:
def set_page_numbering(doc_id):
service = build('docs', 'v1', credentials=creds)
requests = [
{
'insertPageBreak': {
'location': {
'index': 0
}
}
},
{
'insertPageBreak': {
'location': {
'index': 1
}
}
},
{
'createFooter': {
'sectionBreakLocation': {
'index': 2
}
}
},
{
'insertPageNumber': {
'location': {
'segmentId': 'footer'
},
'index': 1
}
}
]
service.documents().batchUpdate(documentId=doc_id, body={'requests': requests}).execute()
This didn’t quite do what I wanted. Any ideas on how to make it work?