简体   繁体   中英

404 File Not Found error using Excel Power Query to .XLSX shared in OneDrive/Sharepoint

I have built a .XLSM (macro-enabled) Excel file that uses standard "Web" method to get data from a .XLSX worksheet saved in my organizational OneDrive for Business/Sharepoint; the file in OneDrive is permissioned to be accessed only by those in Organization. The file is macro-enabled for other purposes, but not for making the data query.

I followed the guidance in the following documentation (from Microsoft) https://docs.microsoft.com/en-us/power-bi/desktop-use-onedrive-business-links

I can then successfully connect to the file and pull down the data in the remote worksheet, but when I share the Excel local file that is making the query with another user in my Organization, they receive an error that the query is not able to be completed.

It appears that Excel is taking the part of my original URL after the Organizational OneDrive domain, and placing it within a relative URL API call.

Here is the error message they receive (I have modified some of the base URL):

[DataSource.Error] Web.Contents failed to get contents from ' https://organization-my.sharepoint.com/personal/username/_api/web/getfilebyserverrelativeurl ('/personal/username/Documents/foo/bar/test_file.xlsx')/$value' (404): Not Found

I don't see this URL or the getfilebyserverrelativeurl function at all in my own version of the file (I'm logged in to the local Excel as the same user that owns the OneDrive account hosting the remote file) - what is Excel/OneDrive doing when it is trying to be accessed by other users who are permissioned to access the file through the Organization? Is there some setting I need to change in the file?

The user will need to get data from web using the following link:
https://organization-my.sharepoint.com/personal/yourusername_domain_com/Documents/foo/bar/file%20name.xlsx

The think you need to validate is

  1. organization-my.sharepoint.com
  2. yourusername_domain_com - (Username of the owner of the file, along with domain)
  3. Documents/foo/bar - (file folder path)
  4. file%20name - (all spaces in file name should be replaced with "%20")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM