How to perform actions on Google Docs smart chips (RICH_LINK ElementTypes)

580 views
Skip to first unread message

Dametrius King

unread,
Aug 11, 2021, 7:21:43 PM8/11/21
to Google Apps Script Community
Hi everyone,

Google's new smart canvas functionality is enabled in my workspace environment so I'm researching how I can perform these actions using Apps Script/Google APIs. However, I've come to a roadblock for which I can't find any Google Documentation. To provide some context, I created a sample Google Doc located here. On the Doc are three different methods of specifying a hyperlink to the same doc.
  1. A plain text URL
  2. A hyperlinked URL
  3. A URL replaced with a smart chip (RICH_LINK)
If you open the script editor for the Google Doc, I've created a getLinks function that recurses through all nested elements and pulls a list of URLs contained in TEXT ElementType elements. I also log to the console each time the ElementType is RICH_LINK for easy debugging. The issue is, I can't find any info whatsoever about RichLink elements, specifically the methods available to it.

If anyone has any insight into how I can process RichLink elements and/or create a new RichLink element, I would greatly appreciate it.

Clark Lind

unread,
Aug 12, 2021, 9:48:02 AM8/12/21
to Google Apps Script Community
It doesn't look like they have added any documentation yet.  You might be able to copy an existing text/richLink element, change the content, and append it back into the doc. I dunno, just thinking on how I would try to 'hack' it. :)
Reply all
Reply to author
Forward
0 new messages