I have a .csv file in a OneDrive folder. The file is created new each day and is produced through a different process. I need to read the records in this .csv file and upload them to a SharePoint list. The flow looks like:
Manually trigger a flow
Step "Content" : Get File Content (Parameters: File Path= /path/to/csv/file)
Step "Compose" : Inputs= (File Content from "Content" step, function = "string(outputs('Content'))"
Step "Split1" : Inputs = (File Content, function = "split(outputs('Compose'), '\r\n')"
When I attempt to feed the output from the split command into a for each construct, the flow fails because the output from "Split1" is just a string, not an array.
Typical output looks like this:
"
["Heading 1,Heading 2\r\nA1,B1\r\nA2,B2{\"statusCode\":200,\"headers\":{\"Cache-Control\":\"no-cache\",\"Pragma\":\"no-cache\",\"Accept-Ranges\":\"bytes\",\"ETag\":\"\\\"{033F9211-5F77-4118-8D74-7CC84A9EC9B2},5\\\"\",\"Location\":\"https://canada-001.azure-apim.net/apim/onedriveforbusiness/shared-onedriveforbu-c5057f29-b02f-462f-9bbb-22e5eb99cc1b/datasets/default/GetFileContentByPath?...
"
If I use a File prompt in the beginning trigger to ask the user what file to use, then use a base64tostring compose step, the split works just fine. But as the input file name will never change, I don't want to prompt the user...I'd like Power Automate just to read the file and process it on a schedule.
I have attached a Word document outlining the steps and the output I see from the Split1 step. Can someone suggest either what I'm doing incorrectly, or suggest a better way to process the csv file and upload the records to a SharePoint list?
Thank you in advance for your help. I appreciate your time.
Best Regards
Dean Powell