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
poweractivate
Super User
Super User

@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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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