Long story short, I regularly paste batches of hyperlinks into Google Docs. When they're copied, they're unlinked and purely raw text. When pasting it into Google Docs however, those links (understandably) don't come up as links, and I have to manually link each one.

Is there a short way for Google Docs to automatically change all "hyperlink-looking" text to hyperlinks?

EDIT: Here's the type of things I'm copy-pasting into Google Docs every week:



etc. (x20)

I already have http:// in front of each link, but since I'm pasting the whole block into Google Docs, it doesn't automatically convert. I'm looking for a way to highlight the whole document, press a button, and change all "link-eligible" text into links.

2 Answers 2


the pattern matching for identifying a link is very basic but this should get you started. It will add a menu to your doc that will look at all highlighted text and make links where it should. (past into script editor, save the script. reload the doc)

the major part of this was modified from this example: https://developers.google.com/apps-script/reference/document/range

function onOpen(e) {
       .createMenu('My Menu')
       .addItem('make links', 'test')

function test(){
var selection = DocumentApp.getActiveDocument().getSelection();
 if (selection) {
   var elements = selection.getRangeElements();
   for (var i = 0; i < elements.length; i++) {
     var element = elements[i];

     // Only modify elements that can be edited as text; skip images and other non-text elements.
     if (element.getElement().editAsText) {
       var text = element.getElement().editAsText();

       if (text.findText("http")){
        text.setLinkUrl(text.getText() )
  • by basic i mean it will only work with the example you gave with each url on it's own line starting with http or https If there is a text element with http somewhere in the middle it will make the whole text element into a (mis formatted) link I do not have the regex experience to set up some thing more robust. Commented Apr 2, 2018 at 7:20
  • webapps.stackexchange.com/a/100070/14529 is one that seems to have worked out the regular expressions and does work with the one-url-per-line format as well.
    – bgoodr
    Commented Jul 5, 2019 at 21:16

Google Docs will automatically create the link for you; just press ENTER after typing (or copying) the link.

enter image description here

Note: This will only work if you include the protocol (i.e. http:// or https://) or www at the beginning of the link. For example, these links will auto-create:


but this one won't:

  • Thanks for the reply. Unfortunately, that's not something that'll help my situation. To give an example, here's the type of text that I'm copy-pasting into Google Docs every week: text text text link text text text link etc. (x20) I already have the http:// in front of each link - but what I don't want is to have to press Enter or Space 20+ times manually to "activate" that link.
    – Google fan
    Commented Mar 2, 2018 at 5:21
  • 1
    @Googlefan Ah, Google Docs can't natively do that. You could find an add-on to make the process easier (like Text2Link4Docs) or you could write a script to look through the document after you paste and convert anything starting with "http" into a link.
    – freginold
    Commented Mar 2, 2018 at 11:36
  • @Googlefan if you have many links that you want to make clickable do this: 1) copy all those links into notepad, 2) change the first link by removing "http" from it 3) copy all links from notepad into the spreadsheet again 4) fix first link.
    – niaher
    Commented Mar 21, 2019 at 6:30
  • 1
    @freginold I tried Text2Link4Docs out on the same "type of text that [the OP] copy-pasting into Google Docs every week" and it won't do what the OP needs. I interpret his question to be that the solution only needs to automatically convert them into clickable links and nothing more than that. But Text2Link4Docs requires you to do some configuration using "%s" expressions which won't be scalable for the OP's workflow, a workflow that matches mine as well (as a result of using addons.mozilla.org/en-US/firefox/addon/open_links_in_tabs and pasting the results into a Google Doc).
    – bgoodr
    Commented Jul 5, 2019 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.