在 Power BI Desktop 中使用商務用 OneDriveUse OneDrive for Business links in Power BI Desktop

許多人都將 Excel 活頁簿儲存在可與 Power BI Desktop 完美搭配的商務用 OneDrive 磁碟機上。Many people have Excel workbooks stored on their OneDrive for Business drive that would be great for use with Power BI Desktop. 有了 Power BI Desktop,您可以使用儲存在商務用 OneDrive 中的 Excel 檔案線上連結來建立報表和視覺效果。With Power BI Desktop, you can use online links for Excel files stored in OneDrive for Business to create reports and visuals. 您可以使用商務用 OneDrive 群組帳戶或您的個人商務用 OneDrive 帳戶。You can use a OneDrive for Business group account, or your individual OneDrive for Business account.

商務用 OneDrive 取得線上連結需要幾個特定步驟。Getting an online link from OneDrive for Business does require a few specific steps. 下列各節說明這些步驟,可讓您在不同電腦中,與同事共用群組中的檔案連結。The following sections explain those steps, which let you share the file link among groups, across different machines, and with your coworkers.

  1. 使用瀏覽器瀏覽至您商務用 OneDrive 位置。Navigate to your OneDrive for Business location using a browser. 以滑鼠右鍵按一下要使用的檔案,並選取 [在 Excel 中開啟]。Right-click the file you want to use, and select Open in Excel.

    注意

    您的瀏覽器介面看起來可能不完全與下圖相同。Your browser interface might not look exactly like the following image. 您可以透過許多方法針對在商務用 OneDrive 瀏覽器介面中的檔案選取 [在 Excel 中開啟]。There are many ways to select Open in Excel for files in your OneDrive for Business browser interface. 您可以使用可讓您在 Excel 中開啟檔案的任何選項。You can use any option that allows you to open the file in Excel.

  2. Excel 中,選取 [檔案] > [資訊],並選取 [保護活頁簿] 按鈕上方的連結。In Excel, select File > Info and select the link above the Protect Workbook button. 選取 複製連結到剪貼簿Select Copy link to clipboard (your version might say Copy path to clipboard).

在 Power BI Desktop 中,您可以使用您剛才複製到剪貼簿的連結。In Power BI Desktop, you can use the link you just copied to the clipboard. 請採取下列步驟:Take the following steps:

  1. 在 Power BI Desktop 中,選取 [取得資料] > [Web]。In Power BI Desktop, select Get Data > Web.

  2. 將連結貼入 [從 Web] 對話方塊 (請選取 [確定])。Paste the link into the From Web dialog (do not select OK yet).

  3. 請注意連結結尾的 ?web=1 字串,在選取 [確定] 之前 ,您必須 移除 Web URL 字串的這部分 ,才能讓 Power BI Desktop 正確地瀏覽至您的檔案。Notice the ?web=1 string at the end of the link - you must remove that portion of the Web URL string before selecting OK, in order for Power BI Desktop to properly navigate to your file.
  4. 如果 Power BI Desktop 提示您輸入認證,請選擇 [Windows] (適用於內部部署 SharePoint 網站) 或 [組織帳戶] (適用於 Office 365 或商務用 OneDrive 網站)。If Power BI Desktop prompts you for credentials, choose either Windows (for on-premises SharePoint sites) or Organizational Account (for Office 365 or OneDrive for Business sites).

[導覽器] 視窗隨即出現,可讓您從在 Excel 活頁簿中找到的資料表、工作表和範圍清單進行選取。A Navigator window appears, allowing you to select from the list of tables, sheets, and ranges found in the Excel workbook. 您可以從該處使用商務用 OneDrive 檔案,就像使用其他 Excel 檔案一樣,並建立報表且就像任何其他資料來源一樣在資料集中使用該報表。From there, you can use the OneDrive for Business file just like any other Excel file, and create reports and use it in datasets like you would with any other data source.

注意

若要使用商務用 OneDrive 檔案作為 Power BI 服務中的資料來源,並針對該檔案啟用 [服務重新整理],請確定您在進行重新整理的設定時,選取 [OAuth2] 來作為 [驗證方法]。To use OneDrive for Business file as a data source in the Power BI service, with Service Refresh enabled for that file, make sure you select OAuth2 as the Authentication method when configuring your refresh settings. 否則您可能會在嘗試連線,或重新整理時遇到錯誤 (例如「無法更新資料來源認證」)。Otherwise you may encounter an error (such as Failed to update data source credentials) when you attempt to connect or to refresh. 選取 OAuth2 作為驗證方法,就能解決該項認證錯誤。Selecting OAuth2 as the authentication method remedies that credentials error.