I am looking to share a google sheet via email in the script. This code correctly creates an email draft, and inserts a hyperlink to my sheet. I would rather have it look like it does when you insert it as a drive link in GMAIL.
Here is a sample of what it looks like when you insert as a drive link
Code:
function getSheetId() {
return SpreadsheetApp.getActiveSheet().getSheetId().toString();
};
function getSheetUrl() {
var SS = SpreadsheetApp.getActiveSpreadsheet();
var ss = SS.getActiveSheet();
var url = '';
url += SS.getUrl();
url += '#gid=';
url += ss.getSheetId();
return url;
}
function notDumb(){
var body = getSheetUrl();
var options = {}
options.htmlBody ='<a href=\"' +body+ '">Here is the File</a>';
GmailApp.createDraft("john@john.com", "Testing",'', options);
}