在 Power BI Desktop 中連接至 CSV 檔案Connect to CSV files in Power BI Desktop

從 Power BI Desktop 連接至以逗號分隔的值 (CSV) 檔案與連接至 Excel 活頁簿十分相似。Connecting to a comma-separated value (CSV) file from Power BI Desktop is a lot like connecting to an Excel workbook. 兩者都很簡單,而本文章會引導您了解如何連接至任何您具有存取權的 CSV 檔案。Both are easy, and this article steps you through how to connect to any CSV file to which you have access.

首先,在 Power BI Desktop 中,從 [主資料夾] 功能區選取 [取得資料] > [CSV]。To start with, from Power BI Desktop select Get Data > CSV from the Home ribbon.

從出現的 [開啟] 對話方塊中選取您的 CSV 檔。Select your CSV file from the Open dialog that appears.

當您選取 [開啟] 時,Power BI Desktop 會存取檔案並判斷特定的檔案屬性,例如檔案來源、分隔符號類型,以及應該使用多少資料列來偵測檔案中的資料類型。When you select Open, Power BI Desktop accesses the file and determines certain file attributes, such as the file origin, delimiter type, and how many rows should be used to detect the data types in the file.

這些檔案屬性和選項會顯示在 [CSV 匯入] 對話方塊視窗頂端的下拉式清單選取項目中,如下所示。These file attributes and options are shown in the drop-down selections at the top of the CSV import dialog window, shown below. 藉由從任何下拉式清單選取器中選擇另一個選項,您可以手動變更任何偵測到的設定。You can change any of these detected settings manually, by choosing another option from any of the drop-down selectors.

當您滿意所做的選擇時,您可以選取 [載入] 將檔案匯入 Power BI Desktop,或者您可以選取 [編輯] 開啟 [查詢編輯器],並且在匯入之前進一步修改或轉換資料。When you’re satisfied with the selections, you can select Load to import the file into Power BI Desktop, or you can select Edit to open Query Editor and further shape or transform the data before importing it.

一旦您將資料載入 Power BI Desktop,您會看到 [欄位] 窗格中的資料表和其資料行 (其會顯示為 Power BI Desktop 中的欄位),就位於 Power BI Desktop 中 [報告檢視] 的右側。Once you load the data into Power BI Desktop, you see the table and its columns (which are presented as Fields in Power BI Desktop) in the Fields pane, along the right of the Report view in Power BI Desktop.

這樣就完成了 – 您 CSV 檔案中的資料現在已經位在 Power BI Desktop 之中了。That’s all you have to do – the data from your CSV file is now in Power BI Desktop.

您可以使用 Power BI Desktop 中的資料來建立視覺效果、報表,或與您可能會想要連接和匯入的其他資料進行互動,例如 Excel 活頁簿、資料庫或任何其他資料來源。You can use that data in Power BI Desktop to create visuals, reports, or interact with any other data you might want to connect with and import, such as Excel workbooks, databases, or any other data source.

後續步驟Next steps

您可以使用 Power BI Desktop 連接至各式各樣的資料。There are all sorts of data you can connect to using Power BI Desktop. 如需有關資料來源的詳細資訊,請參閱下列資源︰For more information on data sources, check out the following resources: