Rename a File (Email > Download PDF > Rename > Upload)

Hi! Can anyone help with advice on a scenario to:

  1. Watch for an email (Microsoft 365 email)
  2. Download attachment (PDF)
  3. Rename document
  4. Upload to Drive (Dropbox)
  5. Email document (Microsoft 365 email)

I can work out all elements except number 3 to rename the document. I want to rename the document using components of the original document name. (Its for a client that requires specific naming convention on their payslips). Current naming convention is:
“Payslip - FirstName LastName DD-MM-YY” and needs to be “Payslip LastName, FirstName - Month Year”

Thinking may need to ‘list attachments’ and have some way of splitting out the named document and then using to map a rename?

Any help or ideas would be greatly appreciated!!

Hey @Layne_Julie_Burgess

you can use an iterator to ‘list’ attachments and then do a filter to only process the attachments which start with ‘Payslip’

also in regards to renaming you can do some regex to break up the original name and then piece back together using date format etc… @Bjorn.drivn did a great post on regex in make: How to use Regex in Make?

And here is a link to the string functions: String functions

Hope that helps!