Query on CSV not recognizing column header name

I’m working on my CSV data import into Query Builder. When I go to Apply changes, I’m being given an error that one of my columns isn’t found. It’s right there. I clicked into the cell to check if there were any extra spaces or anything as the column name - nothing like that showed up.
Full disclosure - I’m working with a static file CSV export from our database on a weekly basis that I’m renaming to current.csv and trying to update everything with a data refresh from my source. So data file structure and source folder, and file name aren’t changing from week-to-week as I refresh the report I’m trying to build. Uploading screenshot, also query in .txt format as well as a sample of my CSV file.Current-sanitized.csv (2.8 KB)

Hello @kjssdca,

Thank you for posting your query onto the Forum.

It would be a bit difficult to guess but what I’ve seen in the CSV file could also be a reason where Power Query not recognizing the column name. Below is the screenshot attached for the reference.

Under the column “Closing Date” one of the row is in “Date” Format and other one is in “General” Format as well as under the “Created Time” column as well one row is in “General” Format and other one is “Custom” Format.

It could also be a step where you might have renamed or re-ordered columns, changed data types, removed other columns, replaced values or possibly it could also be due to change in the format of a particular column of the CSV file that you might have received.

If it’s not obvious by browsing through the query steps, open the advanced editor on that query, copy and paste the entire query into a text editor and do a Find for the column name.

Thanks & Warm Regards,

Try looking in the Transform Data > Advanced Editor, at/near the top in the code look for a line, something like:

Source = Csv.Document(File.Contents("..Current-sanitized.csv"),[Delimiter=",", Columns=97, Encoding=1252, QuoteStyle=QuoteStyle.None]),

Is the number of columns correct?..

Take a look at this post where I show how to handle column names changing in appending csv files:

Also, in your Source step you can remove the “Columns = xx”. It’s not needed and can lead to problems in my view.

Thank you @Harsh, @marcster_uk and @Nick_M . @Nick_M 's reply did the trick. Love having this forum where power users like you all are willing to share your years of experience with newbies like me. Have a wonderful day!

Hello @kjssdca,

You’re welcome. :slightly_smiling_face:

Glad we’re able to help you.

Thanks and Warm Regards,