Forum

Query Not updating ...
 
Notifications
Clear all

Query Not updating because of a different file name..

3 Posts
2 Users
0 Reactions
722 Views
(@moshe_arama)
Posts: 14
Eminent Member
Topic starter
 
Hello everyone ,

I have a file that I manipulate with the QUERY
But every week that I change the name of the file it tells me to change the name of the file 
so that I can perform the manipulation
Why does this happen and how can I overcome it ?

See attached picture

[ Every week i change the file name and i also Advanced-Editor.PNGerorr.PNGNeed-to-cange-the-colum-neme-to-source-name.PNGneed to change the header ] 
 
Posted : 20/03/2023 4:26 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Moshe,

If you are referring to the name of the source file in your query steps, then you change that file name, it's going to break the query because the file name has changed.

To get around this either:

1. Don't change the file name

2. If you have to change the filename, add steps very early in your query (not long after loading the data from file) where you rename the 'Timestamps ..........' column to something else that can then be referred to in later steps.

For example, when you import files using Folder.Files, the 2nd column is the name of the file(s) so to rename that column before doing anything else you could write this.  Note that I'm loading data from a table in the file, that's not important, it's the 2 steps after that that you need.

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
ColNames = Table.ColumnNames(Source),
RenameCol = Table.RenameColumns(Source, {ColNames{1}, "ExcelSourceFile"})
in
RenameCol

Now the column will always be called ExcelSourceFile and can be referred to in later query steps.

See my attached example file.

Regards

Phil

 
Posted : 20/03/2023 9:12 pm
(@moshe_arama)
Posts: 14
Eminent Member
Topic starter
 

Ok Thank You ! 

 
Posted : 21/03/2023 3:53 am
Share: