Accessing Google Drive Files Through Retool Mobile

  • Backstory: We are a small construction company that has fully embraced Retool. We use Google Drive and shared to store all of our project files. We use S3 for photos and other things, but we just can't give up Drive for Desktop and the 'Ctrl+Alt+G' shortcut to search through all of our project files. I've got the drive API connected in browser and mobile apps. So that our field team can browse for files in the field.

  • Goal: Better experience downloading and viewing Google Drive .pdf and images files on mobile. Currently we can download base64 to the device, and using the downloadFiles() utility we can trigger the devices share menu, which if the users scrolls to the bottom they may be able to save the file to their device, figure out where they saved it and then open it. But that's too hard (it's construction after all). I need to get signed url like functionality that will just open these files in the users browser.

Long story short I'm just looking for the best solution. I'm considering creating a lambda function to retrieve the file from google, store it in s3 and send a signed url back to retool, but that will be painfully slow and not very elegant.

Anybody else have any ideas?

Hey @PlywoodPirate! Thanks for reaching out and for sharing that context. We're glad to hear that you've embraced Retool as a business solution. :slightly_smiling_face:

I've spent a while playing around with different options and there just isn't a good solution for consistently displaying base64 media content, neither in the app nor in the browser. The built-in Image component is great for handling image data, as you'd expect, but there's currently no PDF component like there is for web apps. It is being worked on, though, and should be live relatively soon!

If possible, the much simpler option is to generate a URL for each document using their ID - something like https://drive.google.com/file/d/document_id/preview - and open it in the browser. The big caveat with this solution is that each device has to be authenticated with Google Drive, as it doesn't support generating signed URLs.

Speaking of which, your idea build a lambda that eventually returns a signed URL from S3 would definitely work, though I understand that it's not ideal. Even if I'm not able to give you a perfect solution at this time, I hope you find the above at least somewhat helpful!