Monday, 10 February 2014

Auto Hyperlinks with a Google Sheet

Auto Hyperlinks with a Google Sheet


Thanks to a post found on Stack Exchange - I created a quick script to automatically link to studies on the NIHR Portfolio when entering a study ID into a Google Sheet.

The script is quick and easy to implement, in this example the script looks in the first column for values, ignoring the top row.

function onEdit(e) {
  var activeRange = e.source.getActiveRange();
// ID is going in Column 1 and we don't want to inlcude the first row
  if(activeRange.getColumn() == 1 && activeRange.getRow() != 1) { 
    if(e.value != "") { 
      activeRange.setValue('=HYPERLINK("http://public.ukcrn.org.uk/search/StudyDetail.aspx?StudyID='+e.value+'","'+e.value+'")');
    }
  }
}
video

No comments:

Post a Comment