4
votes

Simple Question: I would like to get the URL of the active Document (google spreadsheet) in a specific cell.

So if I enter =GetUrl() in A1 of https://docs.google.com/spreadsheet/ccc?key=XXXXXXXXXXXXXXXXXX&usp=drive_web#gid=16

should give me the result https://docs.google.com/spreadsheet/ccc?key=XXXXXXXXXXXXXXXXXX&usp=drive_web#gid=16 in the cell A1

1

1 Answers

3
votes

A function like this might be useful:

function GetUrl() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  return ss.getUrl();
}

enter image description here

Check: Class Spreadsheet - getUrl()