Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

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

(0) ShareShare
ReportReport
Posted on by 37

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

 

  • BBGG Profile Picture
    37 on at
    Re: Filename not working when copying a file - using Create File action

    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 

  • Verified answer
    v-yiwenxie-msft Profile Picture
    Microsoft Employee on at
    Re: Filename not working when copying a file - using Create File action

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1