Google Dokümanlar dokümanı oluşturan ve dokümanın bağlantısını size e-postayla gönderen basit bir otomasyon oluşturup çalıştırın.
Hedefler
Komut dosyasını ayarlayın.
Komut dosyasını çalıştırın.
Ön koşullar
Bu örneği kullanmak için aşağıdaki ön koşullara ihtiyacınız vardır:
Google Hesabı (Google Workspace hesapları için yönetici onayı gerekebilir).
İnternete erişimi olan bir web tarayıcısı.
Komut dosyasını ayarlama
Otomasyonu oluşturmak için aşağıdaki adımları uygulayın:
Apps Komut Dosyası düzenleyiciyi açmak için script.google.com adresine gidin. script.google.com sayfasına ilk kez gidiyorsanız Kontrol panelini görüntüle'yi tıklayın.
Yeni proje'yi tıklayın.
Komut dosyası düzenleyicideki tüm kodları silin ve aşağıdaki kodu yapıştırın.
/** * Creates a Google Doc and sends an email to the current user with a link to the doc. */functioncreateAndSendDocument(){try{// Create a new Google Doc named 'Hello, world!'constdoc=DocumentApp.create('Hello,world!');// Access the body of the document, then add a paragraph.doc.getBody().appendParagraph('ThisdocumentwascreatedbyGoogleAppsScript.');// Get the URL of the document.consturl=doc.getUrl();// Get the email address of the active user - that's you.constemail=Session.getActiveUser().getEmail();// Get the name of the document to use as an email subject line.constsubject=doc.getName();// Append a new string to the "url" variable to use as an email body.constbody='Linktoyourdoc:'+url;// Send yourself an email with a link to the document.GmailApp.sendEmail(email,subject,body);}catch(err){// TODO (developer) - Handle exceptionconsole.log('Failedwitherror%s',err.message);}}
Kaydet'i tıklayın.
Başlıksız proje'yi tıklayın.
Komut dosyanız için bir ad girin ve Yeniden adlandır'ı tıklayın.
Komut dosyasını çalıştırma
Komut dosyasını çalıştırmak için aşağıdaki adımları uygulayın:
Çalıştır'ı tıklayın.
İstendiğinde komut dosyasını yetkilendirin.
OAuth izin ekranında Bu uygulama doğrulanmadı uyarısı gösteriliyorsa Gelişmiş>{Proje Adı}'na git (güvenli değil)'i seçerek devam edin.
Komut dosyası çalıştırma işlemi tamamlandığında e-postayı Gmail gelen kutunuzda kontrol edin.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2024-12-21 UTC."],[[["This script automates the creation of a Google Doc and emails you a link for access."],["You'll need a Google Account and web browser to use this automation script."],["The script involves pasting provided code into the Apps Script editor and running it after authorization."],["Upon successful execution, you'll receive an email containing the link to your newly created Google Doc."],["Explore further options to extend functionalities with Google Docs, Sheets, and Slides or learn basic JavaScript."]]],[]]