I'm developing a web app with Google apps script where the user will be able to search for and open files from their drive. Right now I display the files with this loop:
var files = DriveApp.searchFiles('title contains "banana"'); var fileCount = 0; while (files.hasNext()) { var file = files.next(); app.getElementById('displayFilesPanel').add(app.createAnchor(file.getName() + ' - ' + file.getOwner().getEmail(), file.getUrl())); fileCount++; } The problem here is that the getOwner() method takes quite some time (about 0.1 seconds) which adds up quite fast. The other thing is that it doesn't look very nice with these links representing files.
Is there any way to do these searches with DriveApp.searchFiles() and display the results with something else than anchors/links?
Edit: As both Zig Mandel and Serge insas mentioned HTML-Service should be considered to make it look better. I found that the DriveApp.searchFiles-function was not very useful because when i use it with parameters like 'title contains "banana"' it will not finish within the 5 min timeout limit. The thing is that it found about 40 matches but then went on and probably checked all the other (>120000) files in my drive. In my case I went with the getAllFilesForPaging(number, token)-function and checked every file if the title contained "banana" with the .indexOf('banana') != -1-method.