2011-10-26 313 views

回答

8

从文档:

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

我不知道,如果你可以上传图片。但是你确定可以通过url将它插入到段落中。

+0

没看到这个。谢谢! – ehfeng

+0

我能够用PNG做到这一点,但出于某种原因,不能用JPEG制作。我为它提交了一个错误报告。 – Fred

+0

@Frederic - 我可以使用所有格式。看到[示例这里](http://stackoverflow.com/questions/15461170/upload-an-image-to-a-google-spreadsheet/15474002#15474002) –

相关问题