Search code examples
google-apigoogle-slides-apigoogle-slides

How to replace all hyperlinks using google slides api?


Referring to the Google slides api official documentation couldn't find a way to replace all links.

I found one work around: Google Slides API: replaceAllLinks?

I am able to replace text, images but not links.

Any help shall be greatly appreciated!


Solution

  • The hyperlink URL is represented by the link field of TextStyle.

    This Link contains the field url, which refers to the URL this is pointing to. You should update this field when calling UpdateTextStyleRequest.

    As an example, your request body could be something like:

    {
      "requests": [
        {
          "updateTextStyle": {
            "objectId": "your_object_id",
            "style": {
              "link": {
                "url": "your_new_url"
              }
            }        
          }
        }
      ]
    }