Automation Gmail to Google Drive

Hi so I used the template for the file upload from gmail to google drive. It does work. it uploads to google drive but I do have a question. Is there any way for me to be able to rename the file differently every single time because when I input a name in the new file name, every file renames to that name only. I have no errors. my only concern is the renaming of the file


what do I put in the new file name for it to be renamed as filename_(number)

@Cazzz1234 The iterator has a variable called “Bundle Order Position” which is the current index of the array its iterating over. Meaning, if you have 3 files this will be 1 , 2 etc.
You could use this variable in your filename for example:

2 Likes

this is what I have. Sorry i am new to this I have very little knowledge

Hi @Cazzz1234,

You don’t need to worry about the index or get function for this as you are using an iterator and you get the filename there directly.

What you want to do is, In Google Drive Module, Check the map option in the file section, which will allow you to pass the filename and file data that you get from the previous module. In there, you can then manipulate the filename to your liking.

Doing something like this will result in unique filename,

1 Like

file name it creates is this. should it be like this?

2 Likes

Yes.

The uuid in above screenshot generates a random 32 character string , What do you want to rename the file to?

1 Like

what if I want to rename the file to a single number only not a 32 character string?

Well in that case I misinterpreted your earlier question and what @Bjorn.drivn was suggesting would work.

But since you uploading that to the same folder when the scenario run next time, it will create duplicate filename i.e 1.pdf, 2.pdf and 1(1).pdf and so on based on new iteration.

You can use datastore to possibly store the number of files uploaded and then increase it by 1 everytime or you can generate a random string(available in mapping option) instead of uuid.

2 Likes

can I ask for a screenshot of how it should be?

this is what I did and the result. Is this okay?



2 Likes

@Cazzz1234 Would you like to show the operations consumed in your invoice name? Instead of that, you could use the example I’ve shown to you above

Using the iterator bundle position, and the mapping which you’ve seen from Runcorn you can get the correct naming

2 Likes