Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Google Dokümanlar dokümanı oluşturan ve basit bir otomasyon derleyip çalıştırın
dokümanın bağlantısını size gönderir.
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 sahip olmanız gerekir:
Google Hesabı (Google Workspace hesapları
(yönetici onayı gerektirir).
İnternete erişimi olan bir web tarayıcısı.
Komut dosyasını ayarlama
Otomasyon oluşturmak için aşağıdaki adımları uygulayın:
Apps Komut Dosyası düzenleyicisini açmak için adresine gidin.
script.google.com değerleridir. Buraya ilk defa gidiyorsanız
script.google.com, Kontrol Panelini Görüntüle'yi tıklayın.
Yeni proje'yi tıklayın.
Komut dosyası düzenleyicideki kodu 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.
*/
function createAndSendDocument() {
try {
// Create a new Google Doc named 'Hello, world!'
const doc = DocumentApp.create('Hello, world!');
// Access the body of the document, then add a paragraph.
doc.getBody().appendParagraph('This document was created by Google Apps Script.');
// Get the URL of the document.
const url = doc.getUrl();
// Get the email address of the active user - that's you.
const email = Session.getActiveUser().getEmail();
// Get the name of the document to use as an email subject line.
const subject = doc.getName();
// Append a new string to the "url" variable to use as an email body.
const body = 'Link to your doc: ' + url;
// Send yourself an email with a link to the document.
GmailApp.sendEmail(email, subject, body);
} catch (err) {
// TODO (developer) - Handle exception
console.log('Failed with error %s', err.message);
}
}
Kaydet'i tıklayın.
Adsı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ş'i > seçerek devam edin
{Project Name} projesine (güvenli değil) gidin.
Komut dosyası yürütme işlemi tamamlandığında Gmail gelen kutunuzu kontrol edin.
gerekiyor.
E-postayı açın ve oluşturduğunuz dokümanı açmak için bağlantıyı tıklayın.