Is there any way to get google classroom form question insert title image URL

49 views Asked by At

I want to get the image url which is inserted when create a question into the classroom form.

Below is the code through we get the title , choices if available but i am not able to get the image url which is insert under the question title.

function getCourse() {
  var form = FormApp.openById(id);
  var formResponses = form.getItems();
  var type=formResponses[0].getType();
  var title = formResponses[0].getTitle();
  var image =formResponses[0].getImage();//no such method Logger.log(image);
}
2

There are 2 answers

0
Wicket On

That image is not available through the Forms Service, it's added through the /viewresponse source code which is generated some way by Google. You could get it by using the URL Fetch Service (UrlFetchApp).

Related

0
harveer singh On

var blob = questionType.getImage();
var b64 = blob.getContentType() + ';base64,'+ Utilities.base64Encode(blob.getBytes()); var html = "data:" + b64 ;