Google Drive specific folder monitoring

Hello,

As a proud LTD member, I’m embarking on my first project and am in the learning phase.

I’ve resorted to using a custom JavaScript node to monitor files within a specific folder because I haven’t found an existing node that meets this need. There seems to be a node that monitors new files across all folders simultaneously, but not one for a specific folder (though I could be mistaken).

Here’s the issue:
I’m attempting to pass a file (pdf and jpg) to the Gemini node for analysis, but it consistently indicates that no file is attached. My attempts have included various methods:

  • URL
  • Download URL
  • Sharing URL
  • Downloading the file prior to inputting it into the Gemini node

My objectives are:

  • To deposit a file into a directory labeled ‘invoice’
  • To process it with Gemini for analysis
  • To create a JSON with specific extracted values (this is functional)
  • To dynamically write the extracted data into the correct column and sheet for accounting purposes (there are multiple sheets for each month, and this is functional)
  • To move the file into a dynamically selected folder named after the month for classification purposes (this is functional)
  • To remove the original file from the upload directory (this is functional)

Currently, the sole issue is transmitting the file to Gemini. It seems like it shouldn’t be a complex task, yet my approach might be flawed. Providing the file’s URL isn’t an option. I’ve even tried a custom Gemini node where I authenticate directly with Google Drive to retrieve the file within the same node, but to no avail.

Additionally, it would be beneficial to integrate the google/gemini-flash-1.5-8b model into the Gemini node, as it’s a remarkably swift model.

Best regards,

1 Like

Could you please share which Gemini nodes you’re using? Are you working with one of our no-code nodes, or are you accessing their API through an HTTP request?

Hi Raian,

I am currently using the file analysis with Gemini, the module you provided. I’ve also attempted to integrate it into a custom JavaScript without success.

I am now attempting to implement it using a custom JavaScript based on the openrouter service; I’ll see how it progresses.

I got access, tested it, and it seems to be processing files correctly - one file per request - without any issues.

Thank you for your response. Is it possible to accomplish this with a Google Drive file? I would like the user to be able to drop the file into a Google Drive folder from their iPhone, and then have it processed automatically.

Here is what I have attempted:

Add a trigger for new files in Google Drive > insert the file ID into the download file action > send the content to Gemini. This seems like a logical solution

Latenode supports multiple triggers, so this scenario is feasible, and your triggers won’t interfere with each other

Thats what i tried at first but there is no way to filter on a specific folder in that node

This is why i created a custom one that will check files in specified folder by id.

Regards,

You can simply filter these values because the trigger also receives the folder ID in the “parents” path where the file was uploaded—here’s how it will look.


To be sure, I checked with the API to verify the folder name corresponding to this ID, and everything matches correctly.

In this case, only files with folder IDs that match the one you need will be processed.

If the variable contains any other value or null (if the file is uploaded to the root folder), the scenario will stop at the filter step.

Thank you for your suggestion; it seems like it will work. However, if there are multiple file transfers to that drive, it will trigger for every new file, potentially leading to excessive credit consumption for files that are not of interest to me.

Does that trigger incur any credit cost to run?

1 Like

In this case, each run will consume credits according to your subscription plan

However, this is currently the only option available

I have found the issue with the Gemini analysis file. The Gemini 1.5 Flash does not process the file properly, whereas the Pro version 1.5 does.

You should consider adding the following model to the list: Gemini 1.5 Flash-8B. This version can process files more quickly and is also less expensive than pro.

With this model, I can manually trigger when I want to pull information with my custom node, without incurring credits for files outside my desired folder.

If you can provide that model, I will be an happy guy!

P.S.: I discovered that my module was retrieving files from the folder that were in the trash, which is why the model was never accessing the correct file. It selected the first file in the list, which was deleted but still in the trash, and consequently, the Gemini module reported that the file did not exist, which was accurate.

I also got it working with a custom node using OpenRouter
using model google/gemini-flash-1.5-8b

the only flaw, by my method it doesn’t take PDF, only image for now.
Trying to find how we can do it with PDF too.

Just a thought, but with the LN limitation of file uploads, you could create a 2 step solution in Zapier using their free account to monitor the folder and send a HTTP request to a LN webhook trigger.

1 Like

No need now since I created a custom node that check the specific folder. That’s an improvement but yes you had a good idea on that one

2 Likes