I am new to Power Query and am trying to combine 30 raw data files into two groups separately. Each group has its column headers and data.
When importing the files into Transform Data page, I need to create a new column as a filter so that I can split the two groups for combining. The new column can ideally display a specific cell value from each raw data file, such as cell value from B2 or B3 etc.
After searching the internet, I guessed some simple column formula for Custom Column with no luck:
=Excel.CurrentWorkbook(){2}[column3]
=Csv.Document(File.Contents([Folder Path]&[Name])){1}[Column1]
Wonder how I can make them work, or if there is another way I can use for filtering the raw data files.
Code below, inserted after the step that returns the table in your screenshot, should return the contents of B3
in the first sheet of each workbook for each of the files.
If you need something else, you'll need to supply more details, such as sample files and structure of those files.
Table.AddColumn(#"Previous Step","Excel", (r)=>Excel.Workbook(r[Content])[Data]{0}[Column2]{2})
or, to actually specify Sheet1
(or any other named sheet):
Table.AddColumn(#"Previous Step","Excel", (r)=>Table.SelectRows(Excel.Workbook(r[Content]), each [Name]="Sheet1")[Data]{0}[Column2]{2})