Forum Discussion
Power Query Relative Path for OneDrive and Other Users
- Jul 19, 2021
That could be like
Source = if Text.Start(filepath,5) = "https" then Web.Contents(...) else Csv.Document(...),but you shall to clean filepath before (remove sheet name and brackets). You may do in sheet by formula or in Power Query by another if then else. Hope it's possible to find ready to use pattern for both.
Power Query itself has no idea with which folder to work and what is current folder. You shall instruct it which folder to take. Such parameter could be taken from CELL("filename"). As soon as you defined folder path, you may use Folder.Files / SharePoint.Files (or Folder.Contents / SharePoint.Contents) connectors to show all files within such folder.
To that folder you may apply filter to select this or that file based on its name (or group of files based on subfolder or something else). Actually that will be imitation of relative part.
But in any case you have to start from defined as parameter root folder navigating within it and ignoring absolute path.
Such approach could affect performance, especially with SharePoint folder.