Forum Discussion
Power Query M Code Not Working When Pasting Into Another Workbook
I have some code that I wrote in Notepad++ basically creating a list and doing a mass find and replace on a column. I pasted it into the Advanced Editor, modified the steps calls, and it worked.
The code (adjusted for posting in this forum):
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Current Value", type text}}),
#"AllReplace" = [#"V1" = "Value 1",
#"V2" = "Value 2"],
#"Replaced Value" = Table.TransformColumns(#"Changed Type",{{"Current Value",each Record.FieldOrDefault(AllReplace,_,_)}})
When I went to paste the code in a new workbook, the code did not work despite everything being the same.
This isn't the first time I've had this issue with pasting in code. Previously, it's just been a bunch of Replace Values steps with no special adjustments to them that I didn't want to recreate in each workbook.
What's going on? Any assistance would be amazing here.
2 Replies
Take the reference below, it may be related to source reference differences, workbook-specific dependencies, even behavior change due to the version of Excel or Power Query, lastly check for any invisible characters (especially it was referring to another editors) and ensure the "Current Value" for the workbook dataset.
Solved: Pasting code back into Power Query, double quotati... - Microsoft Fabric Community
- renee_crozierBrass Contributor
Thank you for sending this over. I read over the article and downloaded Visual Studio and installed the Power Query M extension. After pasting in my actual code, I'm not seeing any holes where it wouldn't work and I'm not getting any error messages. It's simply just not doing anything.