Can't add link picture in googlesheet with many entries

I've try a simple code for just adding image in spreadsheet. Then i tried to combine it with my another entry data using google apps script. but it can't upload the the image anyway.

I've try to find from this discussion
https://community.appinventor.mit.edu/t/upload-files-to-gdrive-followed-by-a-link-of-the-uploaded-file-in-google-sheet/31591

my block:


image

and here my script code:

type or paste code here
```function doPost(e) {
  var sheetName = e.parameter.sheetName;
  var ss = SpreadsheetApp.openById("1i51sxdiyyDj7CJs-QOwIBgR7sgEgTJgU71UW597WUmc");
  var sh = ss.getSheetByName(sheetName);

  // Logika untuk menyimpan data (seperti yang dilakukan dalam doGet)
  if (sheetName) {
    var namaAlat = e.parameter.namaAlat;
    var tanggalPengadaan = e.parameter.tanggalPengadaan;
    var petugas = e.parameter.petugas;
    var cekChasing = e.parameter.cekChasing;
    var cekKabelPower = e.parameter.cekKabelPower;
    var cekTombolPower = e.parameter.cekTombolPower;
    var cekManset = e.parameter.cekManset || ''; 
    var cekElektrode = e.parameter.cekElektrode || ''; 
    var cekBaterai = e.parameter.cekBaterai;
    var cekFungsiTombol = e.parameter.cekFungsiTombol;
    var bersihkanBagianAlat = e.parameter.bersihkanBagianAlat;
    var ujiCobaAlat = e.parameter.ujiCobaAlat;
    //var linkFoto = ''; // Akan diisi jika ada gambar yang diunggah

    // Jika ada file gambar yang diunggah
    if (e.parameters.file && e.parameters.filename && e.parameters.imageformat) {
      var imgf = e.parameters.imageformat[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;

      if (mime) {
        var data = Utilities.base64Decode(e.parameters.file, Utilities.Charset.UTF_8);
        var blob = Utilities.newBlob(data, mime, e.parameters.filename);
        var data = Utilities.base64Decode(data);

        var Bitmap = DriveApp.getFolderById('1Lbrx8bHrAbO2x_KZW3KSdA4OY-pxjRQD').createFile(blob).getId();
        var file = DriveApp.getFileById(Bitmap);
    
        file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);

        var linkFoto = "https://drive.google.com/uc?export=view&id=" + Bitmap;
      } else {
        return ContentService.createTextOutput("Error: Invalid image format");
      }
    }

    // Struktur data yang disesuaikan
    var rowData;
    if (sheetName == "Sheet1") {
      rowData = [
        namaAlat, 
        tanggalPengadaan, 
        petugas, 
        cekChasing, 
        cekKabelPower, 
        cekTombolPower, 
        cekManset, 
        cekBaterai, 
        cekFungsiTombol, 
        bersihkanBagianAlat, 
        ujiCobaAlat, 
        linkFoto
      ];
    } else if (sheetName == "Sheet2") {
      rowData = [
        namaAlat, 
        tanggalPengadaan, 
        petugas, 
        cekChasing, 
        cekKabelPower, 
        cekTombolPower, 
        cekElektrode, 
        cekBaterai, 
        cekFungsiTombol, 
        bersihkanBagianAlat, 
        ujiCobaAlat, 
        linkFoto
      ];
    } else {
      return ContentService.createTextOutput("Error: Invalid sheet name");
    }

    // Menambahkan data ke dalam Spreadsheet pada baris baru
    sh.appendRow(rowData);

    return ContentService.createTextOutput("Success: Data and image (if any) added for " + namaAlat + " in sheet " + sheetName);
  } else {
    return ContentService.createTextOutput("Error: Missing sheetName parameter");
  }
}

This:

Has stopped working, Google made some changes (something to do with cookies)

You will need to download the image to your app and view it from there, or host your images elsewhere

[EDIT] You could try this url:

https://lh3.googleusercontent.com/d/{FILE_ID}