Hi,
When extracting my data using Power Automate I need to update the name of the file with the date/time because i extract data a few times a day and store it in sharepoint.
Normally I have always use the below expression to get a clean date. But i need to now add the “time” to this so that my files don’t override each other. I’ve tried so many versions adding (hh:nn:ss) to the expression but i can not get it to work. Any Ideas?
convertTimeZone(utcNow(), ‘UTC’, ‘Eastern Standard Time’, ‘yyyy/MM/dd’)
I asked ChatGPT this: you are a power bi develop. how do you Adding a DateTime to the name of the file that the file is saved in folder.
In Power BI, you can create a flow to save a report or a dashboard as a file in a folder while appending a DateTime stamp to the file name. Microsoft Power Automate (previously known as Microsoft Flow) can help you achieve this. Here’s how you can do it:
Click on “My flows” and then “New” to create a new flow.
Choose the trigger that suits your scenario. For example, you might trigger the flow when a new item is added to a SharePoint list or when a button is clicked in PowerApps.
Add Actions to the Flow:
Add the “Power BI - Export to file” action. You’ll need to connect to your Power BI account and select the appropriate workspace, report, and format (PDF, PPTX, etc.).
For the “File name” parameter, you can use an expression that includes the DateTime. Click on “Add dynamic content” to build the expression. Here’s an example expression:
This expression generates a DateTime stamp in the format “yyyyMMdd_HHmmss” and appends it to the file name with the “.pdf” extension.
3. Add a File System Action:
Add an action from the “Built-in” connectors, such as “Create file” in OneDrive or SharePoint.
Select the appropriate folder where you want to save the file.
For the “File name” parameter in this action, you can use the same expression you used in the previous step.
Save and Test:
Save the flow and give it a meaningful name.
Test the flow to make sure it’s working as expected. You can trigger it manually or through the chosen trigger method.
Remember that these steps might change slightly based on updates to Power Automate or Power BI, so it’s a good practice to consult the latest documentation or explore the UI options within Power Automate.
Additionally, Power BI itself doesn’t have built-in features to perform file operations like saving with DateTime stamps directly from the Power BI Desktop application. For more advanced file manipulation within Power BI, you might need to leverage external tools, custom scripts, or Power Automate flows as described above.
I’m going to give this format a try (yyyyMMdd_HHmmss)
Sharepoint does have the “date created” column that i can use when connecting and pulling in from Sharepoint. However, if the file name that’s being dropped from PowerBi has the same name as the prior file from an hour ago, Sharepoint doesn’t know what to do with it and it will cause the flow to fail.
I could use the UTCnow() and it will give a unique name so that it will save and everything would be fine… BUT… lol… I’m anal and i like to have all the file names exactly neat and tidy with no odd strings.