Google-sheets – Script to call the sheets sharable link

google sheetsgoogle-apps-scriptlinks

Is there a script for google sheets that calls the sharable link of that specific sheets?

I'm using the Mailapp.sendEmail function to send emails to our manufacturer whenever there is a revision to a job, and I would like to assign the sheets sharable link to a variable so I can put it into the email I send to the manufacturer.

I've looked it up but haven't found any similar questions.

Thanks

Best Answer

var ss = SpreadsheetApp.getActiveSpreadsheet();
var url = ss.getUrl());

https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getUrl()