Forum Discussion
Import Data from Folder with Files That Have Additional Headings
If you combine files from a folder, you can choose which file should act as the example file.
You can try and choose one of the files that has all columns.
Possibly that will be enough to have all files imported correctly.
If not, you may need to specify that missing fields should be ignored.
Anyhow, you can give it a try. If you run into errors, please share these (well specified so we know what is going wrong in which step) so we can help finetuning your queries.
I had tried your tip before posting without success. Here is what I get back: [Expression.Error] The key didn't match any rows in the table.
Another problem I forsee is my first file is always the shorter version, and the filenames change every day so I can't select the longer version file.
- MarcelBeug8 years agoCommunity Champion
If all column names are known, then you can adjust the Transform Sample query and use Table.SelectColumns(Name-of-previous-step,list-with-column-names,MissingField.UseNull).
If any of the columns is missing, then the column will be created with null values.
E.g., if your previous step is "Source" and your required columns are Column1 and Column2:
SelectColumns = Table.SelectColumns(Source,{"Column1","Column2"),MissingField.UseNull)