cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Derek4
Resolver I
Resolver I

How to generate PDF file with date and time as file name

Hi everyone,

 

I'm build a flow which capture the user input to a word template and then convert the word file to PDF, everything is ok until I try to add date and time to the file name. I use this expression as my file name:

 

 

FormatDateTime(utcNow(),'s')

 

 

this is how my flow looks:

微信截图_20210608112929.png

 

 

this is the error details:

 

微信截图_20210608113033.png

 

this is the input of the "convert word to pdf" action

微信截图_20210608113351.png

 

I think it the space in the file name that prevent the action to access the file, but I don't how to get rid of them, can anyone help me?

2 ACCEPTED SOLUTIONS

Accepted Solutions
NiloferA
Super User
Super User

Hello @Derek4 ,

Can you change your expression to FormatDateTime(utcNow(),'dd-mm-yy') and try if it works?

In case if it does not, please expand the individual actions within the scope and post screenshots and also the error you may get after trying this out.

View solution in original post

Hi @NiloferA ,

 

I tried this:

concat('-Print-Date-',FormatDateTime(utcNow(),'yyyy-MM-dd'),'-Time-',FormatDateTime(utcNow(),'hh-mm-tt'))

 and everything is ok now, looks like generate PDF action must use '-' to work and can't have empty space...

View solution in original post

4 REPLIES 4
NiloferA
Super User
Super User

Hello @Derek4 ,

Can you change your expression to FormatDateTime(utcNow(),'dd-mm-yy') and try if it works?

In case if it does not, please expand the individual actions within the scope and post screenshots and also the error you may get after trying this out.

Hi @NiloferA ,

 

thank you for your reply and it works, I'm now one step closer to what I need!

 

is it possible that I add not only date but also time to the file name?

Hi @NiloferA ,

 

I tried this:

concat('-Print-Date-',FormatDateTime(utcNow(),'yyyy-MM-dd'),'-Time-',FormatDateTime(utcNow(),'hh-mm-tt'))

 and everything is ok now, looks like generate PDF action must use '-' to work and can't have empty space...

Hello @Derek4 ,

That's great! 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (2,463)