Hello All,
I am new to working with Flows and am excited for the possibility but am getting frustrated with functions that seem to be straight forward from my experience using JavaScript and yet seem overly complicated in flows. That being said, I would like to solve the problem I have but am open to suggestions of better ways of handling it.
As the subject says, I have new files that are placed in a SharePoint location weekly and I would like to make a copy of this file every Friday and save it into a One Drive folder. Any help would be appreciated.
Thanks,
Ryan
Hi @Anonymous
Flows are about triggers, if you want it to be automatic, i.e. based on a new file being created, at which point you can use the file identifier block from the trigger. If you are looking to continue with a schedule (i.e. every Friday at 5pm) and copy the last modified file from a folder, you would need to use the get files action with a sort on modified and top 1.
When you use the identifier in the get file action, it will put the action into an apply to each (and this can be avoided by using the first() expression) however, the apply to each will only run once and is just as good.
This is the get file content action:
I've a video here on JSON and first() here https://youtu.be/6nJSUNh579w if you want to learn a bit about arrays etc.
Cheers,
Damien
Thats great! By selecting the file within the structure I was able to get a file copied over. and I noticed that it would by default create a text document but by adding the file extension (.xlsx) into the name it worked.
How would I create it to be dynamic so that I can choose the most recent file?
Thanks,
Ryan
Hi @Anonymous
The file identifier looks like you’ve manually typed in a string without a file extension? Is it that action that gives the error?
Another spy is that the path you have supplied for OneDrive is UNC or a local network file share path. OneDrive is cloud and would expect you to supply a http path.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉
Sorry I thought I included it in the other message. In the below image you can see the flow with the SharePoint location identified along with the name of a file I was testing with. On the right you can see the SharePoint location with the file I am trying to get. The error I get says the file was not found.
Thanks,
Ryan
Hi @Anonymous
I just mean a screenshot to understand what you are doing. If it’s always a copy of the same file, you can just browse to the file on the get file content action. If it’s dynamic and based on when a file is created trigger, you would use the dynamic value file identifier from the trigger.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉
Hi @DamoBird365 ,
I see that now. My thought was that I was going to need to use an expression to identify just a portion of the name of a file and thought it would need the contains portion so that it was not looking for a perfect match. I tried just putting the name of a file in the file identifier and it still says it does find the file.
All I want is to make a copy of an excel file each week and place it into a One Drive folder. What do you mean share my action?
Thanks,
Ryan
Hi @Anonymous
Contains expects two parameters, string and value and returns Boolean true/false. You’ve provided one string. Does this help your your understanding? Otherwise what are you trying to achieve? Can you share your action?
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉
Thanks Damien. I appreciate the help. I like the method in which you organize files by dates and luckily these files have a similar nomenclature. I tried to get this flow to run in this setup but am having difficulties. I used the expression contains(formatDateTime(body('Current_time'),'MM-dd-yyyy')) hoping to be able to grab a file based on the date in the name and when it did not work I tried to run with a specific name of a file I know is present but still cannot find the file.
Thanks,
Ryan
Hi @Anonymous
You would use a trigger, when a file is created. Then use the action get file content (using the id of the file from the trigger). Finally you would use the one drive create file action with the content from the get file content action. The file name must include the file extension and I think can either be the dynamic file name including extension from the trigger or be a name that you decide yourself. I often use formatdatetime(utcnow(),’yyyyMMddhhmmss’) to prefix my filenames and ensure they are unique.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1