Forum Discussion
Refresh data from onedrive
- 4 years ago
Hi. You need to find the weburl or the excel file to replace the "C\\" and change the method File.Contents to Web.Content. The following post explains it:
https://blog.ladataweb.com.ar/post/185337134590/alternativa-para-conectar-power-bi-a-onedriveI hope that helps,
Hello - behind the scenes, OneDrive is a Sharepoint document library, so you can use the Sharepoint connector. This is how I retrieve the content from an Excel that I saved in OneDrive but access through Sharepoint.
Note, the query steps below are parameterized for each updating and reproduction.
The object_type is the Excel file object (Table, Sheet, etc). The object name is is the name of the object selected in object type. In this example I am wanting the content of a Table named InputData in an Excel file named (file name specified in input_file_name), which is saved in my OneDrive for Business folder.
Source = SharePoint.Files(sp_site, [ApiVersion = 15]),
get_file = Table.SelectRows(Source, each [Name] = input_file_name),
Navigation = get_file{0}[Content],
file_content = Excel.Workbook(Navigation, null, true),
get_object = Table.SelectRows(file_content, each [Kind] = input_object_type and [Name] = input_object_name),
object_content = get_object{0}[Data],
jennratten Sorry, i'm not fully understanding it (yet). In my PBIX file I have two tables that come from Excel. Currently for both those tables when I go into the query editor the source is:
= Excel.Workbook(File.Contents("C:\Users\name\OneDrive - company.com\PowerBI\Report V3.xlsx"), null, true)
How do I need to adjust this?
- ibarrau4 years agoSuper User
Hi. You need to find the weburl or the excel file to replace the "C\\" and change the method File.Contents to Web.Content. The following post explains it:
https://blog.ladataweb.com.ar/post/185337134590/alternativa-para-conectar-power-bi-a-onedriveI hope that helps,
- Roym4 years agoHelper IV
Thank you both for your help! with the guide from the website I was able to get it working! Thanks
- jennratten4 years agoSuper User
Wonderful!
- jennratten4 years agoSuper User
You should go to the folder that contains the file, then right-click and click View Online. That should open the file in the web. Look in the address bar. Get the text that appears before /_layouts and remove :u:/r/ from the middle. That should be the path to use in the Sharepoint connector.
https://xxxxxxx-my.sharepoint.com/personal/yourname_xxxxxxx_com