Aug 02 2022 06:18 AM
I have a query that is referencing a relative data source that works fine when that source is a specific file. However when I try to direct it to a specific table within that file it isn't reading the data correctly. I'm using Excel 2016. There are only 2 tabs in my Test.xlsx workbook, a settings tab that holds the file location and a tab that shows my table of data.
Example:
This table, "WAGACT", is on a tab named "WAGACT". I just deleted all of the data from that table.
This is the result of the query when it's refreshed:
It should be completely blank but it's still pulling in information from somewhere. I just can't see where it's coming from or how to fix it.
I have the following code:
let
FolderPath = Excel.CurrentWorkbook(){[Name="FolderPath"]}[Content]{0}[Column1],
FileName = Excel.CurrentWorkbook(){[Name="FileName"]}[Content]{0}[Column1],
Source = Excel.Workbook(File.Contents(FolderPath & FileName), null, true),
WAGACT_Sheet = Source{[Item="WAGACT",Kind="Sheet"]}[Data],
#"Removed Top Rows" = Table.Skip(WAGACT_Sheet,2),
Do you see anything wrong with the code that could be causing this? or does anything else come to mind that I should check/change? When I go to the data source settings, it's only showing this, nothing external to the file I'm working with.
I'm still very new to m code other than some work with formulas/columns so I greatly appreciate any help or advice.
Bridgett
Aug 02 2022 06:33 AM
Hi @Bridgett_B
I assume there are a lot more steps in your query than the few that you described. To me it looks as if there might be some joins with other data, at least that is what I guess when I see that "Lookup"-column in your output.
If this is the case, than it could be normal that you still get some outputs, depending on the join that is used.
Could you provide please more information about what your query is going to do?
Aug 02 2022 06:42 AM
Aug 03 2022 12:13 AM
Hi @Bridgett_B
thanks for the details, so obviously my assumption was wrong.
Another thing:
In your screenshot I see that you removed all data from your source table, but the empty rows still do exist. Did you try to delete the empty lines as well, so that only the header (and the first empty row) in the source table remains? And then refresh the query?
Aug 03 2022 08:05 AM
Aug 04 2022 12:48 AM
SolutionHi @Bridgett_B
I think you could continue using your CELL formulas, it's a clever idea.
To avoid the issue you describe when opening another workbook: Just add a cell reference to the formulas:
This way, it will always refer to that cell in this workbook, and not to another workbook.
Aug 04 2022 09:31 AM
Aug 04 2022 12:48 AM
SolutionHi @Bridgett_B
I think you could continue using your CELL formulas, it's a clever idea.
To avoid the issue you describe when opening another workbook: Just add a cell reference to the formulas:
This way, it will always refer to that cell in this workbook, and not to another workbook.