d'accord, le problème doit être dans les blocs ?
If you are uploading the image then the blocks are right (although you continue sending the id folder...which is not necessary because you have it hardcoded in the script).
Did it work when adding a new row? Did it store both, the image ID and the fileName?
non, quand le script était avec l'ajout de lignes il ne stockait pas le non du fichier .
Upload one image to google drive with the app...and paste here the name of the file in google drive.
voilà le fichier de l'image que j'ai téléchargé dans google drive avec l'application
In your drive it is stored like Untitled...can you check in your app the value of filename variable just before to send it in the PostText block?
vous voulez dire que je débogue global filename ?
yes, check if you are sending the filename empty (I guess so) and that's why your file is stored in drive like Untitled and there is no name stored in the sheet.
Are you setting any value to global filename variable somewhere in your code?
If global filename is empty then all is working ok...the file is stored like Untitled in drive and an empty string (the same you are sending) is stored into googleSheet in the third column.
The error is relative to a "select list item" where the list, is not a list but "File".
oui j'ai ça !
if you want a filename for your image, you have to use "filename" variable, and that value will be used for the file name in drive, and it will be stored in the third column of sheet.
If empty, then the file will be Untitled and empty value will be stored in the sheet.
j'ai mis comme ça en pensant pouvoir récupérer l'image par la suite mais ça ne fonctionne pas , par contre dans ma google sheet j'ai la formule qui apparait dans la colonne 3 !
Okay, let's go in parts...first the name of the file.
The value set in filename must be the name of the file you are uploading to drive...the name you want for the image file...if you want a name...if don't want a name, then you can let it empty, or remove that parameter from blocks and script....
Do you understand this? what filename is and what is it for?
If you put filename="my_children_craft" then the file will be stored in drive with that name and that name will be stored in third column of googleSheet...but that is only the file name.
le nom du fichier est celui de l'image que je télécharge, et il sert à récupérer l'image pour pouvoir la lire !
oui j'ai vu.Donc si je mets un fichier complet d'une image je ne pourrais pas changer l'image via l'application ?
No, what you need to be able to recover the image is the ID, stored in the fourth column...the name is only the name...
When you upload a new image with the app, you will have a new file in drive (in addition to the before one) but, the cells C2 and D2 of your sheet will be overwritten with the new fileName (C2) and the new fileID (D2).
d'accord, donc je n'ai pas besoin du nom , je peux laisser vide la valeur "filename" .
ok pour ça.
donc pourquoi je n'arrive pas à récupérer l'image ? dans la colonne 4 j'ai ID de l'image !
Where are you reading the cell D2? in your blocks and in your script?
dans les blocs c'est "imagebrico1"
le script c'est "var imagebrico1" :
if (e.parameter.func == "ReadReport") {
var nom = e.parameter.nom ;
var bricolages = e.parameter.bricolages.replaceAll('|','\n') ;
var imagebrico1 = e.parameter.imagebrico1 ;
var imagebrico2 = e.parameter.imagebrico2 ;
var imagebrico3 = e.parameter.imagebrico3 ;
var sorties = e.parameter.sorties.replaceAll('|','\n') ;
var imagesortie1 = e.parameter.imagesortie1;
var imagesortie2 = e.parameter.imagesortie2;
var imagesortie3 = e.parameter.imagesortie3 ;
var evenemts = e.parameter.evenemts.replaceAll('|','\n');
var imageevene1 = e.parameter.imageevene1;
var imageevene2 = e.parameter.imageevene2;
var imageevene3 = e.parameter.imageevene3;
sh.appendRow([nom,bricolages,imagebrico1,imagebrico2,imagebrico3,sorties,imagesortie1,imagesortie2,imagesortie3,evenemts,imageevene1,imageevene2,imageevene3]);
SpreadsheetApp.flush();
var ref = [ ];
var rg = sh.getDataRange().getValues();
for (var i=0;i<rg.length;i++) {
if (rg[i][0] == nom) {
ref.push(rg[i][0]);
ref.push(rg[i][1].replaceAll('\n','|'));
ref.push(rg[i][2]);
ref.push(rg[i][3]);
ref.push(rg[i][4]);
ref.push(rg[i][5].replaceAll('\n','|'));
ref.push(rg[i][6]);
ref.push(rg[i][7]);
ref.push(rg[i][8]);
ref.push(rg[i][9].replaceAll('\n','|'));
ref.push(rg[i][10]);
ref.push(rg[i][11]);
ref.push(rg[i][12]);
}
}
return ContentService.createTextOutput(JSON.stringify(ref)).setMimeType(ContentService.MimeType.JSON);
}
if (e.parameter.func == "ReadReportData"){
SpreadsheetApp.flush();
var ref = [ ];
var rg = sh.getDataRange().getValues();
for (var i=0;i<rg.length;i++) {
if (rg[i][0] == nom) {
ref.push(rg[i][0]);
ref.push(rg[i][1].replaceAll('\n','|'));
ref.push(rg[i][2]);
ref.push(rg[i][3]);
ref.push(rg[i][4]);
ref.push(rg[i][5].replaceAll('\n','|'));
ref.push(rg[i][6]);
ref.push(rg[i][7]);
ref.push(rg[i][8]);
ref.push(rg[i][9].replaceAll('\n','|'));
ref.push(rg[i][10]);
ref.push(rg[i][11]);
ref.push(rg[i][12]);
}
}
return ContentService.createTextOutput(JSON.stringify(ref)).setMimeType(ContentService.MimeType.JSON);
In that blocks your function is:
and looking at your script, "ReadReportData" function is not using input parameters.....It is sending all the data.
Anyway, are you getting the ID of the image in the responseContent?