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!