Forum Discussion

imarco62's avatar
imarco62
Regular Visitor
2 years ago

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.

5 Replies

  • Anonymous's avatar
    Anonymous
    Not 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.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, imarco62 

    May I ask if you have gotten this issue resolved? If it is solved, please share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.


    If it is not resolved, I hope you will provide the full .pbix file via OneDrive or SharePoint. Please be careful to remove all sensitive information and we will do our best to provide ideas for your issue.

     

     

    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.

    • imarco62's avatar
      imarco62
      Regular Visitor

      I am waiting on the Power BI team to respond. Will post the results as soon as I have them. Thank you.