LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Monday, January 13, 2020

シートでリンクが設定されているセルからリンクURLを取得したい


リンクが設定されているセルからリンクURLを取得したい

大文字の「HYPERLINK」だけでなく小文字の「hyperlink」にも対応させる



コード.gs
function myFunction() {
  var link = returnLink();
  Logger.log(link);
}

function returnLink() {
  var link = "";
  var range = SpreadsheetApp.getActiveRange();
  var formula = range.getFormula();
  if(/hyperlink|HYPERLINK/.test(formula)) {
    var link = formula.split('"')[1];
  }
  return link;
}




Latest post

Creating a template copier app in Google Apps Script

Introduction This article will show you a template copier application in Google Apps Script.  This application will automatically copy a t...