Change a picture using Google Apps Script

Has anyone found support for creating or modifying a drawing using Google Apps Script? I looked at the Google documentation , but I do not see classes for drawing. I learned how to create user interface elements , but not drawings.

I would like to have a drawing as part of a document or spreadsheet, but a stand-alone drawing would be good enough.

+5
source share
3 answers

I got an answer on a related question that is good enough to use as a workaround for this question. You may not be able to modify the Google drawing directly through the code, but you can create a Windows metafile image and then upload it to Google Drawing as described in the Google Docs blog .

Until my function request is complete, this will need to be done.

Update

Now you can create drawings using the Google Slides API . If you want it in Google Drawing, Doc or Sheet, you can copy it there.

+1
source
+5

change rarely involves removal ...

var drawingRange = body.findElement(DocumentApp.ElementType.INLINE_DRAWING);
           while (drawingRange != null) {
               var element = drawingRange.getElement();
               var drawingElement = element.asInlineDrawing();
               drawingElement.removeFromParent();
               drawingRange = body.findElement(DocumentApp.ElementType.INLINE_DRAWING);
           }
-1
source

All Articles