AppSheet file type won't open some .pdf files, all in the same folder

I have a table with a column of file paths and file names to some .pdf documents (all in the same folder).  Clicking on the file icon takes me to some of the pdf files, but for other files the app generates a file not found error.  The paths are correct, and the files are in the folder.  The error occurs in the browser and the iPhone app.  The folder is in a shared drive, and I have a short cut to the folder in my drive.  What am I doing wrong?  Why does the app have a search / file not found error for some files, but works fine for others?  

Solved Solved
0 4 273
1 ACCEPTED SOLUTION

create google script:
function list_all_files_inside_one_folder_without_subfolders(){
  //var sh = SpreadsheetApp.getActiveSheet();
  var sh1 = SpreadsheetApp.openById("your spread sheet");
  var sh = sh1.getSheetByName('Sheet1')
  sh.getRange("a:c").clearContent();
  var folder = DriveApp.getFolderById('folder id); // I change the folder ID  here
  var list = [];
  list.push(['Name','GOOGLEID','Size']);
  var files = folder.getFiles();
  while (files.hasNext()){
    file = files.next();
    var row = []
    row.push(file.getName(),file.getId(),file.getSize())
    list.push(row);
  }
   sh.getRange(1,1,list.length,list[0].length).setValues(list);
}
 
Which creates a column of individual file id's (col A is name, B is file id, C is file size)
 
Then concatenate: CONCATENATE("https://drive.google.com/uc?id=",B2) to make a URL  (I did this in "Sheet2")
 
Then identify the column in app sheet as a url.  ("Sheet2" has the concatenate column along with other stuff)
 
So much for no code environment.  You have to run the script each time there is a change in the folder contents.

View solution in original post

4 REPLIES 4

What do the path values look like, are they all similar?

Yes, app / sheet name and same number

But the pdf files are on a separate shared google drive

create google script:
function list_all_files_inside_one_folder_without_subfolders(){
  //var sh = SpreadsheetApp.getActiveSheet();
  var sh1 = SpreadsheetApp.openById("your spread sheet");
  var sh = sh1.getSheetByName('Sheet1')
  sh.getRange("a:c").clearContent();
  var folder = DriveApp.getFolderById('folder id); // I change the folder ID  here
  var list = [];
  list.push(['Name','GOOGLEID','Size']);
  var files = folder.getFiles();
  while (files.hasNext()){
    file = files.next();
    var row = []
    row.push(file.getName(),file.getId(),file.getSize())
    list.push(row);
  }
   sh.getRange(1,1,list.length,list[0].length).setValues(list);
}
 
Which creates a column of individual file id's (col A is name, B is file id, C is file size)
 
Then concatenate: CONCATENATE("https://drive.google.com/uc?id=",B2) to make a URL  (I did this in "Sheet2")
 
Then identify the column in app sheet as a url.  ("Sheet2" has the concatenate column along with other stuff)
 
So much for no code environment.  You have to run the script each time there is a change in the folder contents.