Send more Image and data Location to GoogleSheet single row

Based TIMAI2 guide.
its work .

But how to add two imageID to single row Google sheet

this my google sheet target []

In Google drive 2 Image was create, but it cant send data image to google sheet.
maybe my problem with app script because im newbie
thank so much

You should send only one post command, including the second image details as additional parameters, then edit the apps script to handle the second image parameters, in order for its details to be added to the same appendRow command, therefore both images will be listed on the same row of the spreadsheet.

1 Like

Not tested, but this amended google apps script should handle the additional image parameters:

function doGet(e) {
 return message("Error: Please Try Again");

var data,blob,data2,blob2;

function doPost(e) {
  if (!e.parameters.filename || !e.parameters.file || !e.parameters.imageformat || !e.parameters.filename2 || !e.parameters.file2 || !e.parameters.imageformat2) {
    return message("Error: Please Try Again");
  } else {
    var imgf = e.parameters.imageformat[0].toUpperCase();
    var imgf2 = e.parameters.imageformat2[0].toUpperCase();
      var mime =
        (imgf == 'BMP')  ? MimeType.BMP
      : (imgf == 'GIF')  ? MimeType.GIF
      : (imgf == 'JPEG') ? MimeType.JPEG
      : (imgf == 'JPG')  ? MimeType.JPEG
      : (imgf == 'PNG')  ? MimeType.PNG
      : (imgf == 'SVG')  ? MimeType.SVG
      : false;
      var mime2 =
        (imgf2 == 'BMP')  ? MimeType.BMP
      : (imgf2 == 'GIF')  ? MimeType.GIF
      : (imgf2 == 'JPEG') ? MimeType.JPEG
      : (imgf2 == 'JPG')  ? MimeType.JPEG
      : (imgf2 == 'PNG')  ? MimeType.PNG
      : (imgf2 == 'SVG')  ? MimeType.SVG
      : false;

      if (mime && mime2) {    
      data = Utilities.base64Decode(e.parameters.file, Utilities.Charset.UTF_8);
      blob = Utilities.newBlob(data, mime, e.parameters.filename);
      data2 = Utilities.base64Decode(e.parameters.file2, Utilities.Charset.UTF_8);
      blob2 = Utilities.newBlob(data2, mime2, e.parameters.filename2);
      var imageID = DriveApp.getFolderById('1AvjKBusD5jCHttEXA24VRGVTYJIv7CyP').createFile(blob).getId();
      var imageID2 = DriveApp.getFolderById('1AvjKBusD5jCHttEXA24VRGVTYJIv7CyP').createFile(blob2).getId();
      var lat =[0];
      var lon = e.parameters.lon[0];
      var add = e.parameters.address[0];
      var name = e.parameters.filename[0];
      var name2 = e.parameters.filename2[0];
      var viewurl = "" + imageID;
      var viewurl2 = "" + imageID2;
      var ss = SpreadsheetApp.getActive();
      var sh = ss.getSheets()[0];
      return message("Success: Image Uploaded and Data Saved");
    } else {
      return message("Error: Please Try Again");

function message(msg) {
  return ContentService.createTextOutput(msg);
1 Like

wow, fast reponse sir. i will try this;
by the way from your script, what mean of these

var lat =[0];

why it use


some tutuorial only

var lat =;

im just try understand your script said, thanks

If I remember correctly, each parameter is inside a list, therefore you have to call the first (and only) item from that list, [0] being the first item (javascript starts lists at 0)

1 Like

:open_mouth: great great thanks for TIMAI2, your script work, even you not tested
based your solution this my block;

thaks so much @TIMAI2 :pray: :pray:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.