Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
688 views
in Technique[技术] by (71.8m points)

powerquery - Power Query: Get Data from an online Excel workbook (OneDrive, SharePoint)

I've asked this before, and I think I got some comments on the question not being specific/researched enough (I'm new here!) So I'm posting again, with a bit more research. Apologies if there is still anything missing:

I need an Excel workbook to get data from another Excel workbook that lives on OneDrive. I want to share the mirror workbook with other coworkers so they can reference it.

As I have it now, on my OneDrive folder in my computer I created the mirror workbook and got data from the master workbook (also in my OneDrive folder). Lastly, I have shared the mirror workbook though OneDrive with a coworker. However, when I test opening the workbook from the coworker's computer, the workbook is still referencing the file path as if it were in my computer where I created the query and the workbook files.

As I understand it, instead of a file path, the workbooks needs a URL to reference the master workbook that lives in OneDrive (which I don't want to share).

I've tried generating different share links from the OneDrive web portal but nothing seems to access. I get access denied messages.

A bit of background, everyone has their own 365 account. And I am doing everything from the app. Not using the browser version of Excel a ay point.

question from:https://stackoverflow.com/questions/65892131/power-query-get-data-from-an-online-excel-workbook-onedrive-sharepoint

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've done SharePoint before using the SharePoint folder data connector. To do this, select that connector option, paste in the site URL (e.g. https://company.sharepoint.com/sites/GroupName/), and use Microsoft account as the authentication method.

Example M query:

let
    Source = SharePoint.Files("https://company.sharepoint.com/sites/GroupName/", [ApiVersion = 15]),
    #"Excel File Name" = Source{[Name="Excel File Name.xlsx",#"Folder Path"="https://company.sharepoint.com/sites/GroupName/Shared Documents/General/"]}[Content],
    #"Imported Excel" = Excel.Workbook(#"Excel File Name"),
    #"Sheet Name_Sheet" = #"Imported Excel"{[Item="Sheet Name",Kind="Sheet"]}[Data]
in
    #"Sheet Name_Sheet"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...