Google-sheets – Bring Google sheet URL to a cell

google sheetsgoogle-apps-script

I want to pull the Google spreadsheet URL into a cell within my sheet automatically.

If I copied my spreadsheet, I would like the entry to reflect the URL of the new sheet. Is this possible?

Best Answer

Yes, it's possible by using Google Apps Script, more specifically by using the getUrl

From the last link:

var ss = SpreadsheetApp.getActiveSpreadsheet();
Logger.log(ss.getUrl());

The above code snippet adds the spredsheets's URL to the logger. To add it to a cell, you could use setValue(value)