Automatically generate images URL

Hello there,

I have a column on my financial app for receipt images. On the excel sheet the data on that column is shown as the file name (generated by appsheet) and I would prefer if it was the link.

From all I have read, I created a new โ€œimageโ€ type column and on โ€œAuto Computeโ€ there is a field called โ€œSpreadsheet formulaโ€ and that is where I have been trying to creat a formula for that.
The table is in dropbox and that is also where the images taken by the app end up as well.
I would like some help to learn how to get that formula right, I am doing it based on the sample app called โ€œimages in sheetsโ€ but I think I am on the wrong path.

Thank you!

1 31 11.7K
  • UX
31 REPLIES 31

With the normal column it wonโ€™t work when you are adding the record. If you open and save it, the link will be correct.

=CONCATENATE(โ€œhttps://www.appsheet.com/template/gettablefileurl?appName=",โ€œAppName-AccountIDโ€,"&tableName=",โ€œTable...โ€,[ImageColumn])

If you add this into the virtual column and the column type is URL, it will generate the link.

Aleksi, you might think about โ€œpinโ€ your answer to show up on the top, as many people asking for this quite a lot.

Better:

CONCATENATE(
  "https://www.appsheet.com/template/gettablefileurl?appName=",
  ENCODEURL(โ€œAppName-AccountIDโ€),
  "&tableName=",
  ENCODEURL(โ€œTableNameโ€),
  "&fileName=",
  ENCODEURL([ImageColumn])
)

You are a star, as always.
Now it is a time for me to go to bed.

For this approach, make sure to disable โ€œRequired Image and File URL Signingโ€ under Security > options if you plans to share those images outside of your organization.

En este escenario me gustarรญa hacer una pregunta:

ยฟComo puedo hacer que se genere automรกticamente el HIPERVINCULO en Google Sheets, sin tener que entrar de nuevo al registro de Appsheet, ya que el nombre del archivo se genera al guardarlo y en Google Sheets el enlace generado no "captura" el nombre del archivo? Es decir que tengo que editar el registro de nuevo para que incluya el nombre del archivo en el HIPERENLACE.

So soon?

Exactly now.

Thanks @Aleksi, @Steve and @tsuji_koichi

I managed to make it work on the virtual column. On the regular column, it creates the link but the link is broken as @Aleksi had already said it was going to happen. I oepend and saved the excel sheet and that did nothing to the link, it still give sme an error, is it really the file that was supposed to be open and saved?

Question 2: Is there anyway that it would generate a dropbox link instead?

If you create Appsheet account using your dropbox account IDs, then it could be possible

I believe thatโ€™s (Dropbox link) not possible through your app.

Yes yes yes @Aleksi
How did you do that?

Unfortunately it was just a sample what you are looking for which is not possible because itโ€™s generated when the image is downloaded.

@Aleksi thanks man! The reality of what the link really says is just โ€œcosmeticsโ€ right? Will the appsheet link for the image be active for as long as the image exists there? Will anyone who has that link have access to the image despite of having a appsheet account or not?

Correct. If you want to show that link, you would need to open your Dropbox account and copy & paste that unique link to your record. Then your user can use that link as long as you have that link in your record. If you manually delete that image, the link will generate an error. The ink is not controlled by the app itself, meaning you control the image from your Dropbox account because itโ€™s a direct link to your image.

Thanks @Aleksi.
And if I use the appsheet link, can I share the link with anyone who has access to it via the table source? Does it expire?

If you donโ€™t delete the image, link doesnโ€™t expire.

Iโ€™m trying to apply this technique to images linked from a folder path from a one drive account but it doesnโ€™t seem to be working.

But, I noticed that if you open an image and right click and โ€œOpen Image in New Tabโ€, the image opens with a a URL of:

https://www.appsheet.com/get/?i=YXBwTmFtZT1Db250ZW50Q3JlYXRpb24tMTI4MjgxMiZ0YWJsZU5hbWU9UG9zdHMmZmls...

How is this URL generated? Is there a way to make a formula that generates this URL?

@Nick_Neumann
Hej, i am not expert, but i accidentaly got it to work by using:
ENCODEURL(SUBSTITUTE([Column that has image name]; " "; โ€œ%20โ€)) .

The content of the column has to be the pathFolderInGoogleDrive/imageName as example:
People_Images/person1.png

Struggeling a bit in my WF template with the URL of my images.
I got the URL to work, and link to be active in template (Google docs), but if the URL is empty, it still comes up in my template with: {โ€œUrlโ€:"",โ€œLinkTextโ€:""} and a link to โ€œBad Requestโ€.
Also it writes out of the tableโ€ฆ
Any idea how to hide a empty link? I tried with:
IFS(ISNOTBLANK([Bilde1]),
CONCATENATE(
โ€œhttps://www.appsheet.com/template/gettablefileurl?appName=โ€,
ENCODEURL(โ€œEntreprenorPRO-1506712โ€),
โ€œ&tableName=โ€,
ENCODEURL(โ€œdbo.Fdvโ€),
โ€œ&fileName=โ€,
ENCODEURL([Bilde1])
))
But this only works (hides it) if TYPE is not URL.

And any tip on how to fix the size of the cell in the google docs table?
(As you can see I tried TEXT-type in Bilde2_url, then it hides if emptyโ€ฆ)


Ahh. Of course. Put the IF expression in the template. Iโ€™ll do that:)

But is it possible to display the URL as โ€œImage1โ€ in the PDF from the template (instead of the full link adress), and still have it as a active link?

You might want to try TEXT([Image]). Then it will generate a directly URL for your image.


Thereโ€™s a catch if you want to store the image URL like above example. When you create an item, the image URL wonโ€™t be populated because the file is not uploaded yet. You will have to refresh (make some change in the row) to set the URL.
However, if you donโ€™t have to store the URL, the virtual column works perfectly.

Perfect! This is only to be used in a WF template, so this shold be perfect!
Iโ€™ll try it outโ€ฆ

Created a tip and trick post for future reference.

Does anybody sees what I did wrong? I am learning to construct URL to file , and I have a test pdf file in the default data folder in Gdrive. Of course I get a bad request.

My VC is :
CONCATENATE(
โ€œhttps://www.appsheet.com/template/gettablefileurl?appName=โ€,
ENCODEURL(โ€œAdministrativ-1042873โ€),
โ€œ&fileName=โ€,
ENCODEURL(โ€œraport.pdfโ€)
)

in browser link with a bad request result is :
https://www.appsheet.com/template/gettablefileurl?appName=Administrativ-1042873&fileName=raport.pdf

I,ve read https://help.appsheet.com/en/articles/2744751-email-attachment-file-archiving and I disabled that sequrity option for files

Thank you

Missing: โ€œ&tableName=โ€, ENCODEURL(โ€œTableNameโ€), ??

I am trying to create an image URL
=SUBSTITUTE(CONCATENATE(โ€œhttps://www.appsheet.com/template/gettablefileurl?appName=",EncodeURL(โ€œSiaa-1468672โ€),"&tableName=โ€, EncodeURL(โ€œSampleโ€),"&fileName=",EncodeURL(M2)), " ", โ€œ%20โ€)

But I am getting bad request? Is there any security feature which we have to allow? Or it there any issue with the way I am writingโ€ฆ

Image Column is โ€œMโ€

hello! how are they?

TO CONSIDER:
app name: test
tables to use:
pdf_files
- pdf_id (text, KEY)
- path (file)
- file (text)
and orders
-order_id(text,KEY)
- customer_name (text)
- client_cell (phone)
- url_pdf(text)
- _pdf_url(url, VIRTUAL COLUMN)

------

I have an app that creates the pdf file and also its url which then stores it in a column in the table. (url_pdf)

Generate an action to be able to view the pdf (view pdf url), referencing the pdf_url and it works like a charm!

The url that opens is the following:
https://www.appsheet.com/template/gettablefileurl?appName=test&tableName=pdf_filesf&fileName=custome...

-------

Now, generate an action to be able to share the pdf by WhatsApp, with plain text, like:

CONCATENATE(
"https://api.whatsapp.com/send?phone=%2B598",
[client_cell],
"&text=%0A%0A*Link to pdf:* ",
[url_pdf]
)

Now I have 2 problems (maybe more):

1. When you share it on WhatsApp, you only pass this url:
https://www.appsheet.com/template/gettablefileurl?appName=test

2. If I copy and paste the following url, which was taken after using the view url action (https://www.appsheet.com/template/gettablefileurl?appName=test&tableName=pdf_files&fileName=customer...) in the browser ( incongnito mode, since the idea is for someone else to open it) it does not show the pdf. It just gives me a blank screen.

Data:

1. Require Image and File URL Signing is OFF

2- The pdf is saved in Google Drive in a folder called pdf_files which was added to the app as a table.

3. A virtual column (_pdf_url) was generated in the "orders" table where the url to be created is concatenated:

CONCATENATE(
"https://www.appsheet.com/template/gettablefileurl",
"?appName=", ENCODEURL("test"),
"&tableName=", ENCODEURL("pdf_files"),
"&fileName=", ENCODEURL(CONCATENATE([customer_name]".pdf"))
)

4. Once the bot starts running, after creating the pdf, it passes the value of _pdf_url to url_pdf

I hope you can help me, I look forward to your comments!

From already thank you very much!

translated by Google

Top Labels in this Space