How do you grab a photo from your device's storage?

I got this error message

Screenshot 2025-04-05 121915

Looks like google is returning an html file error message.

Check you have deployed your web app correctly, and that your files and folders have the correct permissions.

Can you please explain what type of permissions I was suppose to deploy. I just put permissions that sounds good to me

Again you need to read all of this:

and what I said here:

Im so sorry but I got hit with this message right here
Screenshot 2025-04-06 090938

As expected, you did not read or follow the links I provided:

1 Like

I received an error message at my Execution log

Attempted to execute doGet, but could not save

function doGet(e) {
var ss = SpreadsheetApp.getActive(1YsG5LJb5mkFP3w1k0-WVv-kQ7rAvS9o-16zKuyUbBlLUX5D-foYn0lzl);
var sheet = ss.getActiveSheet();
sheet.clear();
sheet.appendRow( ['Filename', 'FileType', 'FileID', 'ViewUrl'] );

var folderId = '1EjhZxyuFy_edited_wkS--QdpauABaMpU';
var folder = DriveApp.getFolderById(folderId);
var contents = folder.getFiles();
var file, name, id, url, type;

while(contents.hasNext()) {
file = contents.next();
name = file.getName();
id = file.getId();
url = "https://lh3.googleusercontent.com/d/" +file.getId();
type = niceFileType(file.getMimeType());
sheet.appendRow( [name,type,id,url] );
}
SpreadsheetApp.flush();
rng = sheet.getDataRange().getValues();
return ContentService.createTextOutput(JSON.stringify(rng));
}

function niceFileType( mimeType ) {

if (typeof this.fileType === 'undefined') {
this.fileType = {};
this.fileType[MimeType.FOLDER] = "Folder";
this.fileType[MimeType.GOOGLE_APPS_SCRIPT] = "Google Apps Script";
this.fileType[MimeType.GOOGLE_DOCS] = "Google Doc";
this.fileType[MimeType.GOOGLE_DRAWINGS] = "Google Drawing";
this.fileType[MimeType.GOOGLE_FORMS] = "Google Form";
this.fileType[MimeType.GOOGLE_SHEETS] = "Google Sheet";
this.fileType[MimeType.GOOGLE_SLIDES] = "Google Slides";
this.fileType[MimeType.JPEG] = "JPG";
this.fileType[MimeType.PNG] = "PNG";
this.fileType[MimeType.BMP] = "BMP";
this.fileType[MimeType.GIF] = "GIF";
this.fileType[MimeType.SVG] = "SVG";
this.fileType[MimeType.PDF] = "PDF";
this.fileType[MimeType.CSV] = "CSV";
}
return (this.fileType.hasOwnProperty(mimeType)) ? this.fileType[mimeType] : "UNKNOWN";
}

Try, as shown in my example, running the script from your app, do you get a list back in your responseContent ?

My believe that the code is due to the spreadsheet save file from the AppsScript because I found a save file for this script and place it where I saw it on the source.

Your code did work but no spreadsheet connected to it and it said the same error message

Screenshot 2025-04-06 104626

Sorry, do not understand what you are saying or doing.

:question:

:question:

I have no idea what is wrong all I know is it has something to do with the spreadsheet code

You get an error message back in html format

Taifun

Below is how I got it so now I am wondering how can we fix this issue

This thread is trapped in an endless loop
Start reading again from here

Taifun

Could you please tell me if I wrote the code correctly because I know that I copied the save file of the spreadsheet and pasted it where it went in the sources you provided me

Also I tried again again got the same results

You cannot do this you just want:

var ss = SpreadsheetApp.getActive();

You need to use your own folder id that contains your images, not the dummy id I provided in my example script

I'm just thinking out of curiosity instead of doing google sheet could we just do a folder for the companion like the app gives you the folder in Google drive to use and you put your own files into it

Would that work for all app users?

How would users share their files with other users ?

I'm sorry for not telling you but the goal is to give each user like an attachment folder that is different than any other user to put their own files in them so that I cannot see what the user's pictures are.

I'm just going to tell you but I don't want to see other users'picture ideas.

In which case, based upon what you have said, there would be no issue in creating a local folder on the device for each user, perhaps /Pictures/YourApp in Shared Storage.