What is the best way to retrieve and view files in app that are generated from templates?

Hu Guys, how are you doing ?

Doing some research here on the community I came to this awesome topic.

I was wondering if I could count on you to help me with Get Url formula.

Firstly I used the formula suggested on this link https://help.appsheet.com/en/articles/2744751-email-attachment-file-archiving and It worked. Then for some reason the suggested formula stopped running.

Please find on this link a demo video to better show the problems I am facing https://drive.google.com/open?id=1KwL47Gwzsccp_kWd3c2jYPFaXiovnaHa&authuser=costa%40costaevalle.com&usp=drive_fs

On this video the formula was working https://drive.google.com/open?id=1L0kAiJv8ETAW5yKtkq9kCIGGnsd_iVV9&authuser=costa%40costaevalle.com&usp=drive_fs

Kind regards,

Hi Fabian

I’m trying to troubleshoot why I can’t open the file I generate in the app and found your comment.

Is it really required to have the spreadsheet inside the app folder?
I couldn’t find this written anywhere in the Appsheet documentation :thinking:

Update: Unbelievable… This has solved my problem. Thanks!!!

@Steve, can we get this documented somewhere? (unless I missed it)…

2 Likes

Yes, at least in some cases, I believe it is correct that currently the file/item folder path is based on the location of the sheet. I have not played with this in a dedicated fashion to determine if in all cases this holds true. And what happens when its a database?

However, I believe this to be a flaw. It is my strong opinion that all pathing should be based on the Default app path set in the app regardless of where the sheet is located. I think I opened a Feature Request for this a long time ago. Maybe its time to find it, dust it off and resurrect it?

1 Like

Adding @praveen for more insight on this :slight_smile:

Here’s an answer from Praveen on this issue:

1 Like

Hey Guys, I am trying to make my emailed attachment pdf to be aaccessible from the link in the app. I am trying to understand the basics of linking to one specific file on my google drive for now. I can’t get it to work. The file path in the google drive is mydrive/appsheet/data/attachments/SITECH_723242305_V15.pdf
I have a column that is a FILE type. My initial value is URL to the file which looks like this.

I get 404 file not found. What am I doing wrong?

Thanks,

Firstly, the paths of your stated G-Drive location and that used in the Initial value are not the same at all.

Second, is this a file that is generated from a workflow? If so, it my understanding, that the storage path of the file is based on the location of your data sheet.

I will guess that your sheet is stored at mydrive/appsheet/data. When an email workflow is run and no path is specified for saving of the generated file, AppSheet will use the folder “Attachments” by default (if I remember correctly). This means any generated files by this workflow will be stored at "mydrive/appsheet/data/attachments"

In the app, when attempting to specify the location of the stored file, you need only specify the path from the sheet root folder which in the example above is the "data" folder.

So you would want to use the path "/attachments/SITECH_723242305_V15.pdf" in your File column.

Hi @SITECH_Mid-Canada I think you use a Workflow to send a PDF as an E-Mail and archive it to your Google Drive.
So your workflow setting includes “AttachAndArchive”.
In “Attachment Folder Path” you can set your own path. But: this will always be located in the folder where your google sheet is located.
Out of the box it will save your PDF files to:
"mydrive/appsheet/data/YourApp/attachments"
I would also recomend to disable Timestamp.
image

Everything you need to know is written in this help article:

1 Like

If you are using Microsoft instead of Google you can easily use Power Automate to save the name of the archived file into an Excel table which can be viewed in App.

  1. Create a table to hold list of reports - bring into App

3 columns
Report Date,
Report Name,
Report Link (=Hyperlink(Report Name)). This is a an Excel formula

  1. Save and Archive using workflow.

  2. Use MS Power Automate to create a workflow
    When a file arrives in specified folder
    Get file info
    Add a row to Excel table with file info

    This runs automatically every time a file arrives in specified folder so Excel table is always up to date

1 Like

Thanks for the tip John. However my sheet is actually in the root directory of my g drive. But you are correct the attachements are stored in appsheet/data/mynewapp-505828/Attachments.I tryied this link as you suggested

/www.appsheet.com/template/Attachments/SITECH_723242305_V15.pdf"
didn’t work

I have seen a conversation above that the sheet needs to be in the myNewApp-50582 directory for the links to work. I moved it and it broke everything. I have pictures and signatures and barcodes in that sheet. they all started acting wonky. And by wonky I mean not displaying randomly. Moving back didn’t fix it. So I had to delete the source in appsheet move he sheet and reconstract everything. Sorry I side tracked.

I also tryied using this expression

http://www.appsheet.com/template/appsheet/data/appName=“MyNewApp-505828”&fileName=Encodeurl(“Attachments/SITECH_723242305_V15.pdf”)"

and i just get this in my browser adress
https://www.appsheet.com/template/appsheet/data/appName=MyNewApp-505828&fileName=ENCODEURL(

So my syntax is wrong i just dont know where?

You are exactly right. I generate a PDF from a template and it is stored in a default directory. What I am trying to do next is put a link to this PDF directly into my sheet. It is usefull if I want to say print the pdf from the app without having to look for it in the emails.

Thanks I will consider this as my fall back plan if I cant figure out this “link” thing.

Please see at the bottom of this article
“Constructing an Attachment File URL”

1 Like

This works perfectly. Thank you so much @WillowMobileSystems .
It seemed much more complicated than what it actually was.