Find word position in google document

Viewed 35

I'm using google docs api for automatic text markup. I need to highlight keywords in a document. I select a word with a query:

requests = [{'updateTextStyle': {
                'range': {'startIndex': start_pos, 'endIndex': end_pos},
                'textStyle': {'backgroundColor': {'color': {'rgbColor': converted_color}}},
                'fields': 'backgroundColor'}
            }]

In order to highlight a word, I need to know its start and end position in the text.

How can I query the start and end position in the text for a keyword?

0 Answers
Related