Hi,
I have a csv file, names xyz.csv. I have made my modifications to the csv and generated the output file (csv) saved in OneDrive. That output file should be named cyz_Output.csv. How can I do that?
Thanks,
Sure lets assume your source file and output file are in different folders in OneDrive.
You can get the source file name by using list file in onedrive action. Use a compose action to extract the name. The expression will be something similar to the below:
substring(outputs('List_files_in_folder')?['body/value']?[0]['Name'], 0, indexOf(outputs('List_files_in_folder')?['body/value']?[0]['Name'], '.csv'))
You can pass that in when creating your output file.
Hi, thanks for the reply. Can you please guide me on how to do that? Very much appreciate your help.
Is your source file in OneDrive as well? You can extract your source file name and pass in through as dynamic contents when setting the new file name.
Yes, but I want to automatically get the input file name followed by output. I don't want to do this every time I run the flow. It should do it automatically.
Not sure if I understand your question correctly but you can name your file as you want, when you use the create a file in onedrive action.
@DryMouse555 You'll need to use an expression to do this. Check out this section of my latest YT Tutorial:
7 Functions You Need to Know | ⚡️Expression Essentials: Part 1⚡️
In this section, I show a flow that takes attachments received from specific emails and saves them to a specific folder on SharePoint. The flow checks to see if a file with the same name already exists, if so—it’ll append a timestamp to the filename. You can use the same concepts covered in this tutorial and apply them to your flow.
In the full tutorial I cover 7 functions you need to know when getting started with expressions.
1️⃣ empty()
2️⃣ coalesce()
3️⃣ equals()
4️⃣ if()
5️⃣ concat()
6️⃣ length()
7️⃣ split()
I cover how to use these functions in expressions and I’ll also cover common mistakes when it comes to writing expressions and show you a few tips and tricks along the way.
As a beginner or even an intermediate flow builder—expressions can seem a bit complex at first, I’m going to try to simplify it for you. If you want to level up your flows by writing expressions—keep watching!
IN THIS VIDEO:
✅ What is an Expression?
✅ What is a Function?
✅ What Does Wrapping a Function Mean?
✅ How Do I Insert an Expression?
✅ How to Use a Compose action
✅ How to Navigate the Expression Builder with Arrow Keys
✅ How to use the Expression Tooltip
✅ Common Mistakes When Writing Expressions
✅ How to differentiate a null from an empty string
✅ How to Get Dynamic Content When it’s Not Listed
✅ How to Use a Get Item Action to Verify Dynamic Content Output
✅ How to Convert Strings to Lower Case
✅ How to Troubleshoot the if() Function