Search code examples
excelpowerquerydata-manipulation

Power Query document not saving changes


I will preface this with I am brand new to Excel Power Query, just learned about it last night and made my source folder containing the csv files to merge (5 total - 2020, 2021, 2022, 2023,2024 (Current year data)). I got them successfully merged and into the output table in excel. All of the data is there.

The problem I am running into is I am working with data from well before my time and a lot of it isn't in the best shape (missing fields, different items in the fields from older procedures, etc.).

So I've gotten the files merged and went into the output table and started correcting some of these issues. When I went back into the query editor, all of those changes reverted back to the original. Am i missing an easy step like a refresh or do I have to go back into all of those source documents and correct them there prior to merging?

Pardon my ignorance.


Solution

  • Power Query (PQ) imports the data, then the data is transformed using the steps you defined in the PQ editor. After that you've obviously chosen to load the data to Excel, into a result table.

    If you edit that result table, you are editing the PQ result, NOT the source csv files. Those remain untouched. Moreover, if you click RefreshAll, PQ empties the table (thus removing your edits!) and does the entire import and transformation again. This is how it is supposed to work. If possible, you should be doing the "edits" as new steps in the Power Query editor. Steps like filtering out empty lines, replacing values, etcetera should be done there so they repeat themselves when you do a new refresh.