google-apps-script
Google MailApp
Suche…
Bemerkungen
Weitere Informationen zu den verfügbaren Methoden finden Sie auch in der offiziellen API-Referenz für GmailApp.
CSV-Datei an eine E-Mail anhängen
Angenommen, wir verfügen über ein System, das täglich Berichte in Form von angehängten CSV-Dateien per E-Mail sendet und auf diese zugreifen möchte.
function getCsvFromGmail() {
// Get the newest Gmail thread based on sender and subject
var gmailThread = GmailApp.search("from:noreply@example.com subject:\"My daily report\"", 0, 1)[0];
// Get the attachments of the latest mail in the thread.
var attachments = gmailThread.getMessages()[gmailThread.getMessageCount() - 1].getAttachments();
// Get and and parse the CSV from the first attachment
var csv = Utilities.parseCsv(attachments[0].getDataAsString());
return csv;
}
Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow