1

I look after our organisations document management system. All documents have a header section with a table. The first column of the table contains the company logo. The company is about to change its logo. There are @ 400 documents. I need to change the logo in each document, it can be the same size as the previous logo.

How do I go about this using Google Apps Script. I can't find a "replaceImage" option in the documentation. I understand how to get all the files, and how to iterate through them, so it is just the image replacement part I don't get?

Thanks

Tim

Metric Rat
  • 196
  • 1
  • 3
  • 12

1 Answers1

0

Try this

var doc = ...;
var header = doc.getHeader();
var table = header.getTables()[0];
var cell = table.getCell(0, 0);
cell.clear();
var newImage = UrlFetchApp.fetch("http://abcde.com/myimage.png");
var image = cell.appendImage(newImage);
image.setHeight(200);
image.setWidth(200);
Tesseract
  • 8,049
  • 2
  • 20
  • 37
  • Thank you for lifting the mist from in front of my eyes :) After a bit of fettling with the image and height and width sizes this works perfectly. – Metric Rat Sep 20 '15 at 22:26