Best answer

Google drive: filename change after being uploaded

  • 26 February 2021
  • 7 replies
  • 2352 views

I am brand new at zapier and google apps script. 
I would like to change the filename that is in the google drive which was uploaded by zapier, to either remove time stamp or change the filename totally.

Currently the filename is "Wed, 24 Feb 2021 23:45:46 +0000 (UTC)Peter White.pdf" I need to either remove the time stamp ending with (utc), or rename it to "240221PeterWhite"

How can I achieve filename change automation?

icon

Best answer by PaulKortman 26 February 2021, 02:58

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 @Stephanolee 

As part of the GDrive Upload File action, a File Name and File Extension can be specified.

 

Userlevel 7
Badge +10

@Stephanolee Thanks for the direct message, but I’ll answer your question here so it’s available for anyone else who might be struggling with something similar. 

 

Troy is correct that you can specify a filename on upload, but you can also rename a file by “moving” it in Google Drive. However, I think the larger issue is that you are trying to figure out how to dynamically remove everything before and including the (UTC) in the file name… 

So I’m not sure what your trigger or inital steps are, but once you get the file/filename into Zapier you can use a “Formatter > Text > Split Text” step to actually split the text on (UTC) or even on just “)” like I do in the example below. 

I have the filename as the input, use ) as the separator (you could use (UTC) instead) and then be sure to set the segment index to Second

Essentially what this is doing is splitting the filename into two parts, part 1 is before the ) and part two is after the ). Then you just specify that as the output you only want part 2 (Second segment index) and now you can use that in the input of what to rename the file to.

 

Please post here if you have follow up questions.

Thank you Paul, I have it set up as you suggested and it tested fine as showing the output as “name” only. but when I run the zap it doesn’t change the filename in my google drive. Do I need to create another zap to produce that output in my google drive? Thanks!

Userlevel 7
Badge +10

@Stephanolee screenshots of the zap steps would be very helpful, you can use this tool to take screenshots or even gifs of your screen so we can see what the zap is set up like. 

I actually was able to fix the original zap to exclude the time stamp so now it is uploading the file with the client name only. Thank you! 

Now, Is there a way to create another zap to add a value found inside the document to the filename?

for example, current filename is “StephanoLee.pdf” and within the PDF file content will have ‘Session No.1’

Is there a way to find this value and place it addtionally to the filename? so that it would display “StephanoLee1.pdf” 

Much appreciated,

Maybe I should create a separate post?

Userlevel 1

@Stephanolee thanks for creating a new post: