@Ekta S. Date There is no out-of-box connector that can help you to validate the CSV headers but you can use different actions to get the CSV header.
I am looping through the attachments and then verifying if the attachment name ends with the CSV or not last(split(items('For_each')?['name'],'.'))
.
If it ends with the CSV name then I am reading the content of the csv file and getting the first rows that has the CSV header details.
first(split(base64ToString(items('For_each')?['contentBytes']),'
'))
Code View : first(split(base64ToString(items('For_each')?['contentBytes']),'\n'))
Workflow:
CSV File passed as attachment:
Variable has the value of headers:
Now you can split the header value by comma and loop in to verify whether your required header is present or not. If you don't want to loop in actions then you can pass the header variable to inline code to perform your business logic (to check the required header) and pass the boolean value or as per your need.
If you have complex logic then in case inline code didn't help then you can offload this functionality to the azure function.