2011-10-26 15 views
10

के माध्यम से Google दस्तावेज़ में छवियां जोड़ें Google Apps स्क्रिप्ट के माध्यम से आप Google दस्तावेज़ (स्प्रेडशीट या प्रेजेंटेशन नहीं) में छवियां कैसे जोड़ सकते हैं। मुझे एक ऐड इमेज विधि नहीं दिख रही है। निश्चित रूप से टीम ने इसे छोड़ दिया होगा।Google Apps स्क्रिप्ट

http://code.google.com/googleapps/appsscript/class_document.html

उत्तर

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

मैं तुम्हें एक छवि अपलोड कर सकते हैं अगर यकीन नहीं है। लेकिन आप निश्चित रूप से इसे एक यूआरएल के माध्यम से अनुच्छेद में सम्मिलित कर सकते हैं।

+0

यह नहीं देखा था। धन्यवाद! – ehfeng

+0

मैं इसे पीएनजी के साथ करने में सक्षम था, लेकिन किसी कारण से जेपीईजी नहीं। मैंने इसके लिए एक बग रिपोर्ट दायर की। – Fred

+0

@ फ्रेडरिक - मैं इसे सभी प्रारूपों के साथ काम करने के लिए मिलता हूं। देखें [उदाहरण यहाँ] (http://stackoverflow.com/questions/15461170/upload-an-image-to-a-google-spreadsheet/15474002#15474002) –

संबंधित मुद्दे