I have this peculiar issue.
I have a source data in XLSM format. This file is generated by download from a source where user can choose number of columns.
Then it is loaded into another file (XLSX) and processed via Power Query and multiple queries and few pivot tables generated from it. There is only limited number of column headings that are used in the queries and those are always present in the source file.
Now, scenario:
- all queries and pivot tables are running fine, all refreshes, no errors, file saved
- prior to download a user selects for download one (or multiple) additional column(s) compared to the source data from step 1, refreshes everything, no error, saves the file
- same processing file from step 2. is used with another source data, but this time with less columns (as compared to data from step 2). Upon "Data>Refresh all" Excel crashes without any warning
I found that it is enough to run my queries on original set of data (step 1 or 2), save, then remove one column (pretty much any from the non-referenced ones) and re-run and it crashes. When I add a column (does not even have to have the same name = header and does not even have to have any data in the new column) the query again works.
I tried clearing permission cache.I tried ’save source data with file’.I tried to remove any references to the removed columns from the pivot tables.... all to no avail.All the queries in Power query editor do refresh ok, no errors. "Close and load" no errors. But upon refresh in Excel it crashes without any warnings.
The only thing that I found works, is to re-create the file from scratch, with exactly the same queries as before (not a single letter changed in Advanced Editor), only this time with less columns in source data.
Interestingly, if source data has more columns than during the last save of the processing file everything works fine.
Any suggestion how to fix this?
Note: running MS Excel 2016 on Windows 10 & 11