cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BBGG
Frequent Visitor

Filename not working when copying a file - using Create File action

Trying to copy an excel file and give the copy a different (dynamic) file name - every time a form is submitted.  The new file name is a comprised of a combination of fields from the submitted form.   That is, for every form submitted an excel file is created with a filename specific to that submission.

 

A first tried to create the desired file name as a string in flow, but found it easier to instead create a field in the excel table containing the form data (Column=ProposalName;  fx=TEXT([@ID],"00000")&"_"&[@[Sales Person]]&"_"&[@[Client''s Name]]&".xlsx")

 

The flow succeeds, that is it doesn't fail.  However, most times it creates a file name missing all the variables.  As a result, instead of a file that should be called "00006_John_ABCCo.xlsx" it creates "00000__.xlsx". 

 

If I re-test the flow using a recently used trigger, the flow not only succeeds but it gets the name correct this time.   I thought the flow might need a few seconds so I've added delays at different locations with same results.  Seems like the flow can't find the right ID record to locate the field.  I'm using Forms for Excel so the form data (and calculate name field) is being automatically saved to the excel file when form is submitted.

 

Any help is appreciated either fixing this issue... or a finding a way to create the filename using flow (e.g. intialize and create a variable?).

 

BBGG_0-1611187900437.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yiwenxie-msft
Microsoft
Microsoft

Hi @BBGG 

 

If you use the column name as the filename of excel and the column contains expression, then it won’t work.

 

But you can use the column value in flow and use expressions in ‘compose’ action to get the filename you want.

 

You could try the flow below:

1.21-11.PNG

 

The functions used:

int(outputs('Get_a_row')?['body/ID'])
concat(string(outputs('Format_number')?['body']),'_',outputs('Get_a_row')?['body/Sales Person'],'_',outputs('Get_a_row')?['body/Clients'' name'],'.xlsx')

 

For the string functions used (concat), go to the link: Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

For conversion functions used (int, string), go to the link: Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

View solution in original post

2 REPLIES 2
v-yiwenxie-msft
Microsoft
Microsoft

Hi @BBGG 

 

If you use the column name as the filename of excel and the column contains expression, then it won’t work.

 

But you can use the column value in flow and use expressions in ‘compose’ action to get the filename you want.

 

You could try the flow below:

1.21-11.PNG

 

The functions used:

int(outputs('Get_a_row')?['body/ID'])
concat(string(outputs('Format_number')?['body']),'_',outputs('Get_a_row')?['body/Sales Person'],'_',outputs('Get_a_row')?['body/Clients'' name'],'.xlsx')

 

For the string functions used (concat), go to the link: Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

For conversion functions used (int, string), go to the link: Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

YES!  This worked perfectly.  I knew there'd be a way to do it in flow but couldn't figure it out using stock actions.  This nifty code was just what I needed! Thanks @v-yiwenxie-msft 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

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 Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (3,518)