Forum Discussion
imarco62
2 years agoRegular Visitor
How to create a file with double quotes around the fields
Hello, I need to generate a file from Power BI where ueach field is sorrounded by double quotes as follows: "field1","filed2", "fieldn" Is this possible? How? Thank you.
Anonymous
2 years agoNot applicable
Hi, collinq
Thanks for your concern about this issue.
And I would like to share some additional solutions below.
Hi, imarco62
I am glad to help you.
According to your description, you want to create a file with double quotes around the fields?
If I understand you correctly, then you can refer to my solution.
You can try to enclose the fields in double quotes directly in Power Query Editor using M language.
As in my example below:
let
Source = Excel.Workbook(File.Contents("XX\XX\XX.xlsx"), null, true),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"field1", Int64.Type}, {"field2", type text}, {"field3", type text}}),
AddQuotesToColumns = Table.TransformColumnNames(#"Promoted Headers", each """" & _ & """")
in
AddQuotesToColumns
Result:
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.