I am uploading csv files to SharePoint using power apps with help of SharePoint attachment control . I wanted to check all attached csv files should contains same column names, If any csv file contain wrong columns name , we should reject that file to uploading to SharePoint .
@Rangannanaik I am not aware of a way in Power Apps Canvas App directly when using the attachment control. You may want to consider processing the file by Power Automate in a Flow with a Trigger being when that element is created (not a Power Apps trigger).
Suppose you must do this without Power Automate - but directly in the Power Apps Canvas App only without any use of Power Automate - if so, it may be possible by, for example, someone copying and pasting the csv content into a control in Power Apps and processing it like that.
If you must use the Attachment control, I am not aware of a way to do it.
It may be possible to do it with some kind of custom control placed in the Power Apps Canvas App that when the file is placed inside, it performs the validations you are talking about, but none of what comes to mind might be very simple.
If someone else knows of way that might be easy to not use Power Automate and not use copy and paste and somehow I would also be curious to know about it.
I feel like if you must require the Power Apps Canvas App to validate the submission, there may be a way to force the validation, but I think you might want to do as follows:
1. Power Automate Flow that has Power Apps as Trigger.
2. Inside the Flow you perform the validation on the content. If it fails, you return to the PowerApp an error message "Respond to a PowerApp or flow" which in Power Apps Canvas App using If function it is checked and will show an error message in that case - otherwise you create file from Flow then "Respond to a PowerApp or flow" with URL of the uploaded file and different status code.
While the above at least will force the experience to take place in Canvas App in real time and not be asynchronous like the first idea I put in this post, it still may require use of Power Automate - I am not aware of an easy solution without using Power Automate.