Complete the code to load data from an Excel file in Power BI.
let
Source = Excel.Workbook(File.Contents([1]), null, true)
in
SourceTo import Excel data, you need to specify the full file path as a string inside File.Contents().
Complete the code to select the first sheet from the Excel workbook.
let
Source = Excel.Workbook(File.Contents("C:\\Data\\SalesData.xlsx"), null, true),
FirstSheet = Source[1][Data]
in
FirstSheetPower Query tables are 0-indexed. Use {0} to access the first sheet's [Data].
Fix the error in the code to correctly load the Excel sheet named 'Sales'.
let
Source = Excel.Workbook(File.Contents("C:\\Data\\SalesData.xlsx"), null, true),
SalesSheet = Table.SelectRows(Source, each [1] = "Sales")[Data]{0}
in
SalesSheetThe column that contains sheet names in the Excel.Workbook output is Name. Filtering by Name = "Sales" selects the correct sheet.
Fill both blanks to filter rows where the 'Region' column equals 'West' and select only the 'Sales' column.
let
Source = Excel.Workbook(File.Contents("C:\\Data\\SalesData.xlsx"), null, true),
SalesSheet = Table.SelectRows(Source{0}[Data], each [[1]] = [2])
in
Table.SelectColumns(SalesSheet, {"Sales"})To filter rows where the 'Region' column equals 'West', use [Region] = "West".
Fill all three blanks to load the Excel file, filter the sheet named '2023Data', and select columns 'Product' and 'Revenue'.
let
Source = Excel.Workbook(File.Contents([1]), null, true),
FilteredSheet = Table.SelectRows(Source, each [[2]] = [3])[Data]{0},
Result = Table.SelectColumns(FilteredSheet, {"Product", "Revenue"})
in
ResultUse the full file path as a string for the first blank, filter by the 'Name' column for the sheet name, and specify the sheet name '2023Data' as a string.