Method for Capturing Original Name of Uploaded File

I'm very much new to Appsheet, and would like to know how to better manage File Upload workflows, and Management of uploaded files in GDrive within the app.

By importing the GDrive folder as the data source in Appsheet, I am able to edit/delete directly those files by references/lookups and grouped referenced actions from other tables within Appsheet.

These allows for live control of GDrive files already uploaded. If I delete a record in a parent table in the app, it will delete the actual related file(s) in GDrive as well, by using "Filename" as the lookup condition. Renaming a file in Appsheet and having it update in Gdrive also works.

However, in the separate process of uploading a new file via the app, I still could not figure out how to capture the original filename. This is the only part missing that I really need, but I may need it as the lookup value in other tables.

So as I understand, uploading images or documents via Appsheet will be renamed with a unique file name? In the below example, original filename is "concept.pptm", but got renamed by Appsheet as "91e90ec1.Upload File.075307.pptm" after upload.

KemAve_0-1725609182934.png

KemAve_1-1725609235828.png

KemAve_2-1725609252985.png

Is there any way at all to retain the original filename (assuming they will have unique doc titles)? ๐Ÿ˜… 

Or are there other best practices out there?

I just really wish for seamless uploading and file management within Appsheet and GDrive.

Solved Solved
0 6 1,714
2 ACCEPTED SOLUTIONS

The only way to do this using the built in file upload feature is to ask the user to type in the file name for the document on the file upload form that you present to the users.
Then when the file is uploaded with the uniqueid tag that appsheet uses, you pass that tag and the users named column to an Appscript task that finds the tagged file and renames it to whatever the user said the file was named.  It's not ideal, but it works.

There is a second way that is far more suitable, but it involves more scripting.  The second way is to use Google Forms (not the built in Google Form Integration method that is now in Appsheet) as the main form for uploading files.  This has the holy grail of allowing multiple file uploads in one go, keeps the original filename (although it does seem to add the name of the person uploading as a suffix to the file name), allows the source of the file to be off the user's local machine OR from any files they have access to in their Google Workspace and finally, allows the administrator to configure the form with limits on which file types and how much data etc it allowed to be uploaded.

I do believe that an update to the Google Forms integration in appsheet will be coming soon that allows for multiple files to be uploaded as the Appsheet dev team have been asking questions ๐Ÿ˜

View solution in original post


@KemAve wrote:

Or are there other best practices out there?


Best practice is to use the name provided by AppSheet for file storage and provide a "display name" in the app. 

There is very good reason for the file rename on upload.  In a multi-user app, there WILL be cases when two people will attempt to upload two different files but give them the same exact name.  It's just the nature of it.  AppSheet's naming conventions ensure that files are NOT overwritten in any way causing issues.  

In reality the names on files are just identifiers in the storage system.  Since each file upload occurs as a data row, you have the ability to save, with each file row, a Name field if you so wish.  The user nevers needs to see the stored filename.  In the app they only see the "display name" listed on that data row.

(EDITED:  I see you may already be aware of this...)  You may also want to check out the article below as another way to manage files stored in Google folders - it does apply to images as well.  It's useful for accessing a collection of files that may be submitted through external means or generated files by app automation.  Through the usage of virtual columns, you can also attach any of such images to data rows in other tables and display them in the the same manner as uploaded files and images.  It does take some extra data columns to achieve but is doable without scripts!!

Use data from Google Drive

I hope this helps!!

View solution in original post

6 REPLIES 6

The only way to do this using the built in file upload feature is to ask the user to type in the file name for the document on the file upload form that you present to the users.
Then when the file is uploaded with the uniqueid tag that appsheet uses, you pass that tag and the users named column to an Appscript task that finds the tagged file and renames it to whatever the user said the file was named.  It's not ideal, but it works.

There is a second way that is far more suitable, but it involves more scripting.  The second way is to use Google Forms (not the built in Google Form Integration method that is now in Appsheet) as the main form for uploading files.  This has the holy grail of allowing multiple file uploads in one go, keeps the original filename (although it does seem to add the name of the person uploading as a suffix to the file name), allows the source of the file to be off the user's local machine OR from any files they have access to in their Google Workspace and finally, allows the administrator to configure the form with limits on which file types and how much data etc it allowed to be uploaded.

I do believe that an update to the Google Forms integration in appsheet will be coming soon that allows for multiple files to be uploaded as the Appsheet dev team have been asking questions ๐Ÿ˜

Thanks for these tips.  I do hope there can be updates in the built-in upload.

I mean I hope they consider just adding a coded UID string to the original filename instead of renaming the file altogether. This way, we can still extract the original filename for direct lookup with Gdrive. 


@KemAve wrote:

Or are there other best practices out there?


Best practice is to use the name provided by AppSheet for file storage and provide a "display name" in the app. 

There is very good reason for the file rename on upload.  In a multi-user app, there WILL be cases when two people will attempt to upload two different files but give them the same exact name.  It's just the nature of it.  AppSheet's naming conventions ensure that files are NOT overwritten in any way causing issues.  

In reality the names on files are just identifiers in the storage system.  Since each file upload occurs as a data row, you have the ability to save, with each file row, a Name field if you so wish.  The user nevers needs to see the stored filename.  In the app they only see the "display name" listed on that data row.

(EDITED:  I see you may already be aware of this...)  You may also want to check out the article below as another way to manage files stored in Google folders - it does apply to images as well.  It's useful for accessing a collection of files that may be submitted through external means or generated files by app automation.  Through the usage of virtual columns, you can also attach any of such images to data rows in other tables and display them in the the same manner as uploaded files and images.  It does take some extra data columns to achieve but is doable without scripts!!

Use data from Google Drive

I hope this helps!!

Thanks much @WillowMobileSys for your insight!


Yes, I do Use data from Google Drive method to generate a virtual table of files from the cloud.
After setting the table access settings to "All Updates", I had been able to manipulate metadata of the files in GDrive within Appsheet, which allowed for lookups used in referenced data actions, and/or bots. 

My issue is just really in the case where I directly upload a file via the app. :)) 

I agree with Appsheet's unique record naming of the file. But I still wish there is some kind of togglable option on "File" type column regarding native file names to have it set as initial value, with a default Valid-if clause to check if there's existing file with the same native filename, which should prevent duplicate uploads and prompt for a different filename input.

For now, I set an automated filename display (as you mentioned) via an initial value.

---------------


@KemAve wrote:

I had been able to manipulate metadata of the files in GDrive within Appsheet, which allowed for lookups used in referenced data actions, and/or bots.


For these activities, I ensure that when the file is saved (such as in generated PDF files) that the filenames have details indicating what record that file belongs to.  I then parse that filename using Virtual Columns in the AppSheet Folder Table so I can link the file to the record through references.  We can actually use the "Is part of" property so that when the original record that generated the file is deleted, we can have all related files automatically deleted as well - if we wish.  No need to manipulate the GDrive details at all.


@KemAve wrote:

But I still wish there is some kind of togglable option on "File" type column 


I understand the appeal.

 

 

Thanks for this ๐Ÿ™