2012-12-27 35 views

回答

0

假設你能得到的電子郵件作爲一個字符串的身體,這裏是你可以嘗試:我不熟悉谷歌腳本

var doc = DocumentApp.getActiveDocument(); 

// Use editAsText to obtain a single text element containing 
// all the characters in the document. 
var text = doc.editAsText(); 

// Insert text at the beginning of the document. 
text.insertText(0, 'Your Text To Insert.\n'); 

//Find search for your results 
text.findText(searchPattern) 

,但我希望這可能可能你指出正確的方向。

https://developers.google.com/apps-script/class_text

+0

感謝您的及時答覆,如果這是要走的路,我還沒有找到一種方法來插入我的文字到文檔中。我的文本是我在變量message_body中發送的電子郵件消息的主體,但我無法找到將其寫入文檔的方法。 – user1931379

+0

@ user1931379你能得到什麼?你把電子郵件的正文作爲一個字符串嗎? – SnareChops

+0

@ user1931379你也可以創建一個新文檔,然後將文本添加到它,我想這就是我在上面的答案中試圖做的,但我現在看到我正在加載以前的文檔,而不是創建一個新的文檔。我會稍微更新我的答案以說明如何。 – SnareChops

相關問題