*Edit - found a solution! I wound up running the output through another replace to clean up the added quotes in the end prior to writing to the CSV file (lots of digging through the forums here led me to the solution).
-----------------
Racking my brain on this one, I've tried every string manipulation tactic I can think of in the flow, but it's not working right.
I have a CSV file that I upload to SharePoint with four columns, very basic, all string data (first name, last name, ID number, status), and then I have a MS Form that collects the same information and adds it to a separate SharePoint list.
My flow grabs the file from a local file share and uploads it, then processes it into JSON data in order to allow me to merge it with the contents from the separate list, then create a new CSV file in the end which then gets emailed to a few users for a separate business process (it's a fast process compared to a regular CSV parse, so all of this works).
The issue is when I'm processing the list data to add it to the new CSV file.
I'm using a 'get items' to grab the content from the list, then an 'apply to each' to process each item and the value from each field and then add item to the CSV file...very standard.
This again is working, but I need to add double-quotes around the last value (Status Value) to have it formatted to match the already existing data in the original CSV file.
Without any string manipulation, the data comes in as:
Example: (First Name, Last Name, ID Number, Status Value)
Eric,Smith,WD12345,Student
What I'd like is to have it formatted as:
Eric,Smith,WD12345,"Student"
Every time I try to add quotes into the string for that value, it comes out with three sets of double quotes instead of just one set.
Example:
Eric,Smith,WD12345,"""Student"""
I've tried adding in the quotes directly in the AddItem section
I've tried in expressions using concat variations, substitutions, compose statement to add it as output, URL decoding, replace statements...and so many combinations of each in separate or nested versions...
concat('"', item()?['Status/Value'], '"')
concat(outputs('addQuote'), item()?['Status/Value'], outputs('addQuote'))
substitute(concat(outputs('addQuote'), item()?['Status/Value'], outputs('addQuote')), '\"')
concat(decodeUriComponent('%22'), item()?['Status/Value'], decodeUriComponent('%22'))
replace(item()?['Status/Value'],'"""','"')
Nothing really seems to be working. Either it doesn't have a double quote at all, or any version that does manage to add them in always seems to add it in triplicate!
If anyone has an idea of how to do this, I'd really appreciate the help.
All I want is to surround one string (Status Value) with double quotes, it should be easy, just basic string manipulation, but for some reason it's not being easy.
I can post more screenshots, peeks at code, whatever may be helpful.
Thanks!
if(empty(string(item()?['VisitIdentifier'])), '', concat('', string(item()?['VisitIdentifier']),''))
Michael E. Gernaey
798
Super User 2025 Season 2
Tomac
469
Moderator
Power Apps 1919
333