cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
n8greene
Level: Powered On

Create CSV Table - How to add quote marks around a value to handle leading zeros

Hi- My flow creates a CSV file that the user will open in Excel. One of the columns is zip code, which sometimes has a leading zero, for example 04101 When the user opens the CSV in Excel, it trims the leading zero off the zip code and displays 4101. The best solution I can think of is wrapping the value in quote marks on the CSV but I can't figure out how to do that. I tried: Concat('"',item()?['PracticeZip'],'"') but it returned """04101""" Obviously, the value I want printed on the CSV is "04101" with the quotes but without quotes around the quotes. Any suggestions on how to get this to work? Thanks
6 REPLIES 6
Community Support Team
Community Support Team

Re: Create CSV Table - How to add quote marks around a value to handle leading zeros

Hi @n8greene,

 

You could take a try with expression below:

concat('"',item()?['PracticeZip'],'"')

I have made a test on my side to create a flow as below:

Capture.PNG

 

The expression in the Compose 2 as below:

concat('"',outputs('Compose'),'"')

The flow would run successfully as below:

Capture.PNG

 

Best regards,

Alice

n8greene
Level: Powered On

Re: Create CSV Table - How to add quote marks around a value to handle leading zeros

Hi Alice-

Thanks for the response, but the solution you provided does not work when pulling values from a SharePoint list and then placing them into a CSV.

 

To restate the problem, I want the csv export to look like this (for example):

Smith,John,16 Main St.,Portland,ME,"04101",Anesthesiologist, etc.

(I need the zip code  in quotes so preceeding zeros will not be stripped off when opened in excel. )

The solution you provided casues this result:

Smith,John,16 Main St.,Portland,ME,"""04101""",Anesthesiologist, etc. (this does not render right in excel)

 

I've pasted my test flow below to demonstrate. The value in the sharepoint list is simply 04106.

Test  Flow:

2019-01-14 09_09_05-Edit your flow _ Microsoft Flow.png

Result:

Pic2.png

 

Pic3.png

Community Support Team
Community Support Team

Re: Create CSV Table - How to add quote marks around a value to handle leading zeros

Hi @n8greene,

 

Would you please add a () to the value as below:

Capture.PNG

Capture.PNG

 

Or you could add a space before the value as below:

Capture.PNG

Capture.PNG

 

Best regards,

Alice

 

Re: Create CSV Table - How to add quote marks around a value to handle leading zeros

I have this issue too, has anyone found a solution for this?

Super User
Super User

Re: Create CSV Table - How to add quote marks around a value to handle leading zeros

I feel like this issue might not be a Flow issue, but rather an Excel issue. When you open the CSV file in excel (without surrounding the zip code with quotes) can you set the column data type to be Text so it just evaluates the content it finds literally?

Re: Create CSV Table - How to add quote marks around a value to handle leading zeros

Hello,

 

the Flow I'm trying to build gets data from SharePoint and uploads a CSV to SFTP where the file will be processed by one of our Finance systems. This systems expects every value in the CSV to be surrouned by double quotes so

 

"1","Name","Address"

 

I open the CSV in Notepad, rather than Excel to see the format.

 

My Flow looks like this, and in the Concat I've tried setting a value to:

concat('"',item()?['Amount'],'"')

csvtable.JPG

This results in """1""","""Name""" rather than "1","Name"

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 185 members 4,549 guests
Please welcome our newest community members: