Link to home
Start Free TrialLog in
Avatar of Doug Van
Doug VanFlag for Canada

asked on

Google Docs to PDF (custom script to exclude embedded URL links in gDoc)?

Hello all,

Can anyone provide some tips on how I can create a script to scan a gDoc and remove all embedded URL links.

I am building release notes where each issue has a link to the jira issue number in order to help release notes contributors. However, when I am ready to publish this document to a PDF, I do not want the end users to see the embedded links (they would go nowhere anyway).

Currently, Google doesn't include any options for Save As [to PDF] so I was thinking of writing a script that would:
1) Temporarily find and remove all embedded URLs links (this is the primary goal - the rest is nice to have)
2) Print to PDF
3) Revert/return all the links

Although I am familiar with programming in a few languages (including basic JavaScript), I have never built a Google Script. Is what I am trying to accomplish, even possible?

Currently, I am reviewing the API here: https://developers.google.com/apps-script/overview

Any help is appreciated.

Thank you,
Shawn
Avatar of Doug Van
Doug Van
Flag of Canada image

ASKER

Found this one reference but I cannot get this to work:

stackoverflow.com/questions/26729517/google-apps-script-how-to-remove-a-link-from-a-document

I appreciate any help. Thank you.
Hmmm.... no help? :(

Experimenting a bit more, ideally what I want the script to automatically do, is the following:

1) Make a copy of master document
2) Search and remove all links within the body of document (but ignore one specific URL)
3) If link font attributes remain (blue / underlined text), search and remove them.
4) Save As PDF

Can this even be accomplished with a Google script?

Thank you
SOLUTION
Avatar of Randy Downs
Randy Downs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Randy, I am sharing the award with you b/c, at least, you tried to help. Ty.