I have a column with hyperlinks formula in it, for example:
=HYPERLINK(\"http://example.com\", \"Link\")
I want to get additional column, w
You can accomplish this by using Apps Script to create a custom function. Try this:
In Code.gs, paste the following and save:
function EXTRACT_URL(input) {
var range = SpreadsheetApp.getActiveSheet().getRange(input);
var re = /^.+?\(\"(.+?)\",.+?$/;
if (input.indexOf(':') != -1) {
var formulas = range.getFormulas();
for (var i in formulas) {
for (var j in formulas[i]) {
formulas[i][j] = formulas[i][j].replace(re, "$1");
}
}
return formulas;
} else {
return range.getFormula().replace(re, "$1");
}
}
This creates a custom function. In your Google Sheet, you can use this function as you would use any other function; however, there's one caveat, which is that you'll have to put the cell in quotes, e.g.:
=EXTRACT_URL("A1")
To make the quotes thing less of a hassle, the above script supports ranges as well:
=EXTRACT_URL("A1:B10")
Hope this helps!
Try this formulas
A2=index(SPLIT(SUBSTITUTE(FORMULATEXT(A1),"=HYPERLINK(""",""),""","""),1,1)
example
A1=HYPERLINK("http://example.com", "Link")
result is
A2=http://example.com
One way would be to copy the column containing the formulae (assuming you would like to retain them) and remove the 'excess'. The removal can be achieved with Edit > Find and Replace... with Replace with left blank in each case:
The part to the left:
Find =HYPERLINK("
and check Also search within formulae
(If you want to break the link, put '
in *Replace with *.)
The part to the right:
Find ".+
and check Search using regular expressions and Also search within formulae.
You can use Google Apps Script and a combination of Macros, Menus, and Custom Functions to extract the value of the hyperlink out of the cell's formula.
Here's how it would work:
Code.gs
Code.gs
with the contents from this Pastebin, taken from this Google Docs Help Forum
topic=HYPERLINK
functionsExtract -> Replace formulas with Text strings
to initiate the scriptThe macro will recursively extract out the URL of the hyperlink function, leaving you with just the value.
Note: Always make a backup of your work before making any changes.
I would recommend performing this task on a duplicate spreadsheet or at a minimum a copy of the original cells in case anything should go wrong of if you wish to retain the original cell's content or formatting.