function emailDocTestasDocx() { var id = '10odsSY4XX3TNhRjlmZoLOo2g3yNOP9g3pBebrk25G8g';// an example of Google doc var url = 'https://docs.google.com/spreadsheets/d/10odsSY4XX3TNhRjlmZoLOo2g3yNOP9g3pBebrk25G8g/edit#gid=754080197'; var doc = DriveApp.getFileById(id); //used ID to get the file saved in your Drive using DriveApp.getFileById() method var me = Session.getEffectiveUser().getEmail(); MailApp.sendEmail(me, 'test', 'see attachment', {attachments:[doc]}); //attach the file via email }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter