save file in online url sharepoint folder with dynamic name

Good evening,

I have a flow and I can save a file with a dynamic address and a dynamic name in a local directory.

I have built a string that cointains the file path+the name.

I have then converted the string to path variable using the “string to path (variable)” node.

The path variable results in the form: “C:\Users\username\company\main folder\subfolder\filename.xlsx”.

The problem is when I try to save the file directly in the online sharepoint folder.

In this case I would need a string like: “/Documents/main folder/subfolder/filename.xlsx”.

But when I use the node “string to path (variable)” the address is authomatically converted in the form: “\Documents\main folder\subfolder\filename.xlsx”.

“/” becomes "" and that is not fine for writing in the sharepoint.

Can anyone help me in finding a solution? I want to avoid to write the file locally because I want different users to be able to use the workflow.

See the picture below