Forum Discussion
PQ Run-time error '1004': [Expression.Error] The Column 'Column2' of the table wasn't found.
Thank you for your reply but I find when people just post links to other sites to be completely unhelpful.
It seems to be a trend on forums in general rather than actually providing real help. This is sadly the case on the mainstream Excel forums but I did not expect it to have infected Microsofts own forums.
If I knew what I was doing then I would not need to ask for help and, although it does not seem to be appreciate, I have done darn well to get my code to where it is without help.
There is no point in my reading tech articles on the subject if I do not understand the jargon - hence why people ask for help. I am a person who learns from doing, not reading and as I said in my post "I am not experenced in PQ".
Time used to be where experts liked to impart thier knowledge and their help, notwithstanding the fact that they gave thier time for free (greatly appreciated).
Your reply has not provided any real help so I am unable to mark it as solved.
It is very difficult for me to tell what is going on without examining a representative CSV file. My best guess is that the referenced CSV file does not have a "Column2". Possibly if you examine the CSV file in a Text Editor, you can see that.
The fix would require re-writing the query so as not to have column headers hard-coded. This can be done in a variety of ways, generally using Table.ColumnNames(#"Previous Step") to access a list of column names in the order shown in the #"Previous Step".
For example, to set all of the columns to type text, one could use:
#"Changed Type" = Table.TransformColumnTypes(Source, List.Transform(Table.ColumnNames(#"Previous Step"), each {_, type text}))
modified as needed for a VBA routine.
And so forth.
Or you could extract the column names from the first line of the CSV file in VBA, and then modify the query to use those names appropriately.