Best answer

Retrieve a URL from googe drive file

  • 22 June 2022
  • 7 replies
  • 903 views

Userlevel 1
Badge

Hello,

 

I need the URL of the file from Google Drive in order to upload to Affinity. It only allows to run the zap if it is a URL.

The workflow is - receive an attachment form gmail - upload this attachment to google drive - retrieve the file from google drive through URL and run a python code to upload in Affinity,

 

When I try to retrieve the file from google drive I can only find the name of the file, the file and the file id, but not the URL.

 

Could you please help me?

 

Best,

 

 

icon

Best answer by jesse 29 June 2022, 00:35

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

7 replies

Userlevel 7
Badge +14

Hi @Michael_CalmStorm 

Good question.

When using the GDrive Upload File Zap action, there will be a few URLs returned.

Alternatively, you can use a GDrive Find File Zap action step to get those URLs.

 

Userlevel 7
Badge +9

Hey @Michael_CalmStorm! I have been following along with your email thread with support and wanted to circle back and close the loop. 

First and foremost, it looks as though we logged a feature request to be able to Extract File(s) using the Formatter app. We’ll circle back and update this thread if/when that becomes available! 

Secondly, I wanted to paste the workaround my colleague @Lionel_Selie shared with you as it may be useful for others building a similar workflow to yours:

I had a quick peek at this and we can make this work, but it does require a nifty setup to make that work.
 
First, we'll need to specify whether the trigger events has one or multiple attachments, which we can do with a Code by Zapier step:
 
(Click here to view larger)

output:
 

(Click here to view larger)
 
Copy the following code:

// Define "lineItemIDs" in the Input Data section.
// Get the number of line items.
return { line_items_count: inputData.lineItemIDs.split(',').length };


We can then use Paths by Zapier to go down Path A if number is lesser than 2 and use the attachment object as the input, which does have a link that can be accessed (the Zap serializes the data, and makes it available for uploading to another service). The file type should not matter.
 
In case there are multiple attachments, we can use a Convert File in ConvertAPI step to extract each, which will return an individual URL for each attachment. By then using a Create Loop From Line Items in Looping by Zapier we can upload each file individually.

Let us know if we can help with any other questions!

Userlevel 7
Badge +11

Hi @Michael_CalmStorm!

Have you had a chance to try the suggestion that Troy made? Please let us know if you managed to get this working, or whether you could still use some help :)

Thanks!

Userlevel 1
Badge

Hello Troy,

 

Thank you for the answer, I tested all links but I still was not able to find the file in my CRM. 

Links that showed as an option and I tested: 

alternate link
download link 
parent parent link
parents self link
embed link
icon link
self link
thumbnail link
user permission self link
web content link

 

  1. Which one should be the file? I searched for the file name and it is not showing in any of the URLs.
  2. I ran a code for uploading the file, the code ran, but the wanted file was not found in Affinity system.
  3. In several tests I spotted the error:

 

Thank you again!

Userlevel 7
Badge +14

@Michael_CalmStorm 

The File name is not part of the File URL for a GDrive File.

The File name is a different data point returned from the GDrive step.

 

You can use this utility to determine the GDrive directly file download link, which may need to be used:

https://sites.google.com/site/gdocs2direct/

 

EXAMPLE

FROM: https://drive.google.com/file/d/XXX/view?usp=sharing

TO: https://drive.google.com/uc?export=download&id=XXX

Userlevel 1
Badge

Hey Troy thank you for your answer, but I don’t see how I can include this in the zap.

 

Is it possible to add a webhook in the google drive folder, so whenever I receive a file, the zap will be triggered? Maybe I’ll be able to get the URL from there.

The URLs that appeared in the examples above didn’t work.

I haven’t found this topic in the community.

 

Best,

 

 

Userlevel 7
Badge +14

@Michael_CalmStorm 

Try this Zap trigger: GDrive - New File in Folder