2011-10-26 18 views

Odpowiedz

8

Od docs:

function insertImage() { 
    // Retrieve an image from the web. 
    var resp = UrlFetchApp.fetch("http://www.google.com/intl/en_com/images/srpr/logo2w.png"); 

    // Create a document. 
    var doc = DocumentApp.openById(""); 

    // Append the image to the first paragraph. 
    doc.getChild(0).asParagraph().appendInlineImage(resp.getBlob()); 
} 

http://code.google.com/googleapps/appsscript/class_documentapp_listitem.html#appendInlineImage

Nie jestem pewien, czy można przesłać obraz. Ale na pewno można go wstawić do Akapitu za pośrednictwem adresu URL.

+0

Nie widziałem tego. Dzięki! – ehfeng

+0

Byłem w stanie to zrobić z PNG, ale nie z JPEG z jakiegoś powodu. Złożyłem dla niego raport o błędzie. – Fred

+0

@Frederic - Rozumiem, że działa ze wszystkimi formatami. zobacz [przykład tutaj] (http://stackoverflow.com/questions/15461170/upload-an-image-to-a-google-spreadsheet/15474002#15474002) –

Powiązane problemy