Best answer

Find a File in Google Drive - partial match

  • 29 December 2022
  • 8 replies
  • 934 views

I have a Zap step that has a Find a File in Google Drive step.

It looks for Sheets documents in a specific Drive folder.

Each sheet name has a unique ID (email address) plus additional data in the file name.

I want do to a partial match on file name, returning any sheets that contain the ID in the name.

However, the search step is only finds exact matches on the file name.

Is there a way to do partial matches on file names?

icon

Best answer by nicksimard 5 January 2023, 19:46

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.

8 replies

Userlevel 7
Badge +9

Hey there, @MariaGarcia! Thanks for reaching out in the community!

Hmm, good question - I found a related topic on fuzzy searches here that I wonder could be repurposed here?

In short, it doesn’t sound like the search function automatically supports what you need but it’s possible there are workarounds.

I hope some of this helps - keep us posted though! 🙂
 

Hey there, @MariaGarcia! Thanks for reaching out in the community!

Hmm, good question - I found a related topic on fuzzy searches here that I wonder could be repurposed here?

In short, it doesn’t sound like the search function automatically supports this but it’s possible there are workarounds.

I hope some of this helps - keep us posted though! 🙂
 

Thanks for the suggestion.

I don’t think that give me what I want, as it relates to filters on specific field, whereas I’m looking for a solution to doing partial matches on filenames in a folder.

Userlevel 7
Badge +9

Hey @MariaGarcia thanks for clarifying! Let’s chat through this one a bit. Let’s say we could figure out a way to do a “fuzzy” search in the way you’re needing and found multiple files with a certain term. Are you needing to return multiple files and then take an action on each on that’s returned? Once we know a bit more about your desired outcome, we may be able to brainstorm some workarounds for you!

I do think, however, the workaround may need to include triggering on new files, adding them to a Google sheet, and then doing a “fuzzy” search in that regard. But, let’s wait and see what you come back with before we get too into the weeds. 😉

Hey @MariaGarcia thanks for clarifying! Let’s chat through this one a bit. Let’s say we could figure out a way to do a “fuzzy” search in the way you’re needing and found multiple files with a certain term. Are you needing to return multiple files and then take an action on each on that’s returned? Once we know a bit more about your desired outcome, we may be able to brainstorm some workarounds for you!

I do think, however, the workaround may need to include triggering on new files, adding them to a Google sheet, and then doing a “fuzzy” search in that regard. But, let’s wait and see what you come back with before we get too into the weeds. 😉

Thanks for the reply Jesse.

My need is actually much simpler. I want to search for the existence of any file in a given Drive folder where the file name contains a given text string.

If any file name matches, then I want to return TRUE, and if no file name matches, I want to return FALSE.

I don’t actually care about the specific file names or file IDs that match.

Userlevel 7
Badge +11

Hi @MariaGarcia!

If you only care about whether there is ANY file that contains a given string, how about a Zap that triggers on new files being added and then have a Filter step to make sure the file name contains that string, then you can use something like Google Sheets to store that.

Before I dive into details it’s important to know whether these files move from folder to folder, have their names changed, and/or get deleted sometimes.

That would make my little workaround much trickier (and maybe not even feasible).

Hi @MariaGarcia!

If you only care about whether there is ANY file that contains a given string, how about a Zap that triggers on new files being added and then have a Filter step to make sure the file name contains that string, then you can use something like Google Sheets to store that.

Before I dive into details it’s important to know whether these files move from folder to folder, have their names changed, and/or get deleted sometimes.

That would make my little workaround much trickier (and maybe not even feasible).

So basically you’re saying that there’s no way to do the kind of file name search I want, so instead I’d have to create a Google Sheet with all the file names and check in that?

I could do that, but it’s an ugly solution for what I think should be a simple problem.

Is there really no way to do a file name search with a partial match?

Userlevel 7
Badge +11

Hi @MariaGarcia!

I’d been taking for granted that a partial match wouldn’t work, which is why I thought of a workaround.

I just tested a Zap and was able to match a single word within a longer file title. Then I renamed that found file and tested again. It found a second file that contained the word “partial” in the title.

I even tried removing the folder from my search and instead searched my whole drive. It still found that file that had the word “partial” in its title.

3b0c139afc8a0911bf2635d81cccc9e3.gif

 

So the way you’re wanting it to work is actually how I’m seeing it work. You’re not able to find files in this same way? Are your file titles such that there are dashes-between-words-like-this maybe, and that might affect it?

Hi @MariaGarcia!

I’d been taking for granted that a partial match wouldn’t work, which is why I thought of a workaround.

I just tested a Zap and was able to match a single word within a longer file title. Then I renamed that found file and tested again. It found a second file that contained the word “partial” in the title.

I even tried removing the folder from my search and instead searched my whole drive. It still found that file that had the word “partial” in its title.

3b0c139afc8a0911bf2635d81cccc9e3.gif

 

So the way you’re wanting it to work is actually how I’m seeing it work. You’re not able to find files in this same way? Are your file titles such that there are dashes-between-words-like-this maybe, and that might affect it?

That works fine. Thank you.

Given that, I would just say that the documentation for the search function is not very helpful. I assumed it would do an exact match search, while it actually does a partial match search, and I did not see that specified in the documentation.