Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

How to restrict bad csv uploading into SharePoint

Hi Team,

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 .


Kindly let me  know the approach or solution



Ranganna Naik


@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. 

1b. Use this as guide: 

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.

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,117)