i take this simply script the manage my letters:
var body = DocumentApp.getActiveDocument().getHeader();
body.clear();
var cells = [
['', ''],
];
var myT = body.appendTable(cells);
var picture = UrlFetchApp.fetch("https://storage.googleapis.com/gweb-uniblog-publish-prod/static/blog/images/google.a51985becaa6.png");
myT.getCell(0, 0).appendImage(picture.getBlob());
myT.getCell(0, 1).clear()
var txt = myT.getCell(0, 1).editAsText();
txt.setText("\nThats me");
txt.setFontFamily("Arial");
txt.setFontSize(0, txt.getText().length-1, 22);
In GoogleDirve i have a picture which i want to use in my letter-headline. When i will share the picture i get a link like this: "https://........0B9nuxx16xEgdT593SSSkUVZJw4c/view?usp=sharing". --> But this link is not working in the script.
Thanks
How about following sample script?
The image blob can be retrieved using DriveApp.getFileById(fileID)
. From your question, it seems that the ID of the shared image is "0b9nuxx16xegdt593ssskuvzjw4c". If this is wrong ID, please modify it in the sample script.
var body = DocumentApp.getActiveDocument();
body.clear();
var cells = [
['', ''],
];
var myT = body.appendTable(cells);
var picture = DriveApp.getFileById("0b9nuxx16xegdt593ssskuvzjw4c");
myT.getCell(0, 0).appendImage(picture.getBlob());
myT.getCell(0, 1).clear()
var txt = myT.getCell(0, 1).editAsText();
txt.setText("\nThats me");
txt.setFontFamily("Arial");
txt.setFontSize(0, txt.getText().length-1, 22);
If I misunderstand your question, I'm sorry.