I am trying to work through the process to update a list from CSV based on unique values. I do NOT have a table, only a list. The CSV file is saved from email as part of flow 1. Flow 2 sees the new file, and now I want to get the content and create a table from CSV. My next step would be to take the content output and use the Create CSV table, but the output from the get content is not the file data. How to I get the columns and data from the CSV?
@grantjenkins GOT IT!! It took a bit, I had hidden spaces in the 'Select' step that were causing the field to not be referenced, smh!! I can't thank you enough for sticking through this thread, this will be a huge help to the team and our process. Much appreciation @grantjenkins !!
@grantjenkins @Nived_Nambiar Implementing the above, the filter array is not producing an output:
Array is using the body of select
And the body of Select Session ID (Select 3)
In the item expression I have tried both variations of how Session ID is shown :
I have confirmed that the 2 test rows from my CSV are not present in the SP list. Not sure what I am missing here
Hopefully this is what you're looking for.
For this example, I'm using the same flow as before but added more to it. I'm also using the following SharePoint List. I'm using Record Number - you would just need to change it to suit your fields.
See full flow below. I'll go into each of the actions.
Everything up to the Select is the same as what we had before.
Get items returns all the existing items from our SharePoint List.
Select Record Numbers retrieves all the Records Numbers from the list. Note that Map uses Text mode.
Filter array Items to add filters out the records so only the ones that don't exist in the list are returned (the ones we need to add). IMPORTANT: From uses the output from Select. The condition uses the output from Select Record Numbers and the following expression to get the current Record Number.
item()?['Record Number']
Apply to each iterates over each of the items from Filter array Items to add.
Create item adds each of the items that don't exist in the list (Record Number doesn't exist). It uses the following expressions.
//Title (Name)
item()?['Name']
//Record Number
item()?['Record Number']
//Amount
item()?['Amount']
After the flow runs, we will have our additional fields added.
@grantjenkins I think I am close, hopefully just a little more and I can get to the finish line!
With your feedback I was able to get my csv data into a table. I have built the rest of the flow to:
Get list items, compare list column to table column, where the table row is not found create item.
I am stuck on how to identify the columns in the table output??
@grantjenkins Thanks so much! I am probably in over my head. I have a flow that saves (csv) file from email to folder (sharepoint). What I am ultimately after is once daily file is saved, to be able to update a sharepoint list with only specific data from rows where the unique identifier is not present in the list. I have done some research and have been able to get the data using 'compose', but I need array to put into table to reference columns from file to list. I don't know if it's in scope to screen share live, but I sure could benefit from a conversation! Thanks again for the help!!
Hopefully this is what you're looking for. It will extract the data from the CSV file and give you an array of objects that can be used to update a SharePoint List, etc. I'm not entirely sure what you want to do with the data once you have it.
For this example, I'm using the following CSV file that contains three columns.
See full flow below. I'll go into each of the actions.
When a file is created (properties only) is set to look for files added to a folder called Assorted Files. I haven't put any checks to see if it was a CSV file - assuming only CSV files will be added here.
Get file content uses the Identifier from the trigger.
Filter array extracts out the data and removes the last empty row we get. The expressions used are:
//From
//converts the data to string, splits on new line, and skips the header row (only want the data)
skip(split(base64ToString(body('Get_file_content')['$content']), decodeUriComponent('%0D%0A')), 1)
//Condition
trim(item())
Select uses the output from Filter array and maps out the headers and values using the following expressions. This assumes I know what the headers are and they are always in the same order in the CSV. You would just increase the index for each new header (depending on your CSV).
//Record Number
split(item(), ',')[0]
//Name
split(item(), ',')[1]
//Amount
split(item(), ',')[2]
After running the flow, I would get the following output.
[
{
"Record Number": "1",
"Name": "Bob",
"Amount": "20"
},
{
"Record Number": "2",
"Name": "Jane",
"Amount": "35"
},
{
"Record Number": "3",
"Name": "Joe",
"Amount": "21"
},
{
"Record Number": "4",
"Name": "Bill",
"Amount": "68"
},
{
"Record Number": "5",
"Name": "Andy",
"Amount": "102"
}
]
I'm not sure what you want to do with the data once you have it in this form. If this is all you're after and can move on from here then all good. Otherwise let us know and we can help build out more for you.
@Nived_Nambiar is that a premium connector? I am not seeing a read option available in built in or standard.
@grantjenkins Yes, headers would always be the same and no, there would not be commas in the data.
Would the column headers in the CSV file attached to the email always be the same?
Also, would any of your CSV data have commas within the values such as "Hello, my name is Bob"? Or just commas separating each of the values?
Hi @JTischler
I think you have to try this way.
first rename file with .txt extension. like if the file name is data.csv , rename it to data.txt
Read the renamed file content and then use this as input to create html table using Create HTML Table.
Hope it helps 🙂
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional