Forum Discussion
Issue: queryM automatically adds leading zeros that should not exist
- 2 years ago
Are you certain the leading zero's are being added by your query?
Are those leading zero's present at the initial step in Power Query before any transforms?
Are the leading zero's present in the Source file (excel)?
Please post an example of what you see in the actual Source file (Excel), what you are seeing the first Applied Step in PQ, and what you want as an outcome.
Ok, thank you for these questions as they made me 2nd geuss myself.
And you were on to something.
The sourcefile DOES have the leading zero's, but they were not visible to me since Excel does its automagic. Opening the source file with a proper editor shows the leading zero's being in the source. And to make it even better. The data is not clean, one document has leading zero's where the other one has not. . .
Check your basics. Thanks for asking the questions!
Yes, when Excel is dealing with text/csv files, it is always important to go back to the original source, and also to import (using Power Query or the legacy import wizard) rather than open, unless very certain of the data and how Excel will transform it when executing the Open.