Is it possible to get the file ID of the PDF created by Automation?

I'm trying to create a PDF file and store it in Google Drive. I want to share that file with anyone I invite to the folder. The following URL generated when the file path is set in the file type column is bad because it can be referenced by people other than the invited person.
https://www.appsheet.com/template/gettablefileurl?

Therefore, I want to set the URL in this format to the column on the Appsheet. I want to know the file id for that.
https://drive.google.com/file/d/XXXXXXXXXXXXX/view?usp=sharing

0 6 686
6 REPLIES 6

This isn't automation, but a use of access such as SSO type seem to be used perhaps cause it lead me to Google signing page through I already was signed in. Strange behavior this is I see.

Thank you for answering. You are commenting on the fact that you were able to see the file at https://www.appsheet.com/template/gettablefileurl?
However, I don't think single sign-on worked because I've never logged in with an "allowed gmail account" before. Thank you for answering.

Strange that you do not login to use AppSheet. Please explain how you do then.  I would love to know your workaround 

I don't understand well what you're trying to accomplish. It sounds related to  Solved: Creating new folder in Google Drive from Appsheet - Google Cloud Community . Maybe the solution there points you in the right direction.

Sorry for the poor explanation, everyone.
What I want to do is to share a purchase order PDF created by a person in company A with people in company B, C, and D, who are the recipients of the order, via Google Drive.
(Company B, Company C, and Company D do not have an Appsheet license.)
In Google Drive, there are folders for Company B, Company C, and Company D, and I have restricted them in advance so that only my company's folders can be viewed.
Specifically, we are considering the following steps.
(e.g., when placing an order with Company B)
1. Company A person creates a PDF file in Company B's folder in Appsheet. This is done in Appsheet's Automation. After this, the path and file name of this folder ("Appsheet/appname/order form/Company B/created file.pdf"... โ‘ ) is saved in the Appsheet record in Automation.
2. Email the URL of file โ‘  to the person in Company B.
What I want to do is to send the URL in the format of https://drive.google.com/file/d/ใƒ•ใ‚กใ‚คใƒซID/view?usp=share_link.
Now I only know how to send it in the following format. If I use this method, people from Company B, Company C, and Company D who do not have a license of Appsheet cannot see the file.
I want to send it in the following format. So I want to get the URL of file โ‘  in the format of URL https://drive.google.com/file/d/ใƒ•ใ‚กใ‚คใƒซID/view?usp=share_link. Better if it can be done with a formula. If you know how to do it in GoogleAppscript, please let me know that too.

https://www.appsheet.com/template/gettablefileurl?appName=%E7%89%A9%E5%93%81%E7%AE%A1%E7%90%86-62308... 8%E6%9B%B8PDF&fileName=%2Fappsheet%2Fdata%2F%E7%89%A9%E5%93%81%E7%AE%A1%E7%90%86-6230850%2F%E7%99%BA%E6%B3%A8%E6%9B%B8%2F%E3%82%A2 %E3%82%B9%E3%82%AF%E3%83%AB%E6%A7%98%2F%E7%99%BA%E6%B3%A8%E6%9B%B82023-02-19%E3%82%A2%E3%82%B9%E3%82%AF%E3%83%AB%E6%A7%98BUS012. PDF&appVersion=1.000417&signature=26c60ec1dedb9d17f601af274d6f679b92a37e363f19994f7b8f9979638e53d11433072f8a4924194257022633cd366e

Sorry for the length of this message.

โ€ปTranslated with www.DeepL.com/Translator (free version)

I think that the solution I previously linked to includes portions that should be a good starting point for addressing your need:

You can use Apps Script's DriveApp to "Allows scripts to create, find, and modify files and folders in Google Drive", including getFilesByName and even searchFiles. As necessary, for a file you can then getUrl, getDownloadUrl, getId, and more. Somewhere in there you presumably have the pieces you need for whatever URL you're looking to provide.

Top Labels in this Space