cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rangannanaik
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

 

Regards,

Ranganna Naik

1 REPLY 1

@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: https://flow.microsoft.com/en-us/blog/howto-upload-return-file/ 

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

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,671)