Showing results for 
Search instead for 
Did you mean: 
Level 8

Download Files from SQL Server

Hello fellow PowerUsers !


I need you help on a question which I know is tricky.

I have an Application whose datasources are stored on a SQL Server 2014 (OnPrem)

In the DataBase Tickets, I have (to simplify) table Ticket and table Attachments.

The table attachments is like this :

Id int => Primary key, ID of the attachment records.

TicketID varchar (100) => ID foreign key of ticket
FileTitle varchar (MAX) => Any title a user can enter

FileImage image => the image itself.


With PowerApps, I have been able to upload my data table with new attachments. Word File and Image File are OK.
I have been able to display Image files in a Image control.


Since my user will be storing images and other files (.PDF, .docx..), he asked me to be able to download these files (images AND .pdf etc...) on his computer.

I have seen the answer here ( Downloading-PDFs-from-SQL-Server  ) and this desperates me so much...
So, do you have any idea for a workaround to download files from SQL Server ?

Maybe by doing a stored procedure like the following (even if it does not take the different harddrive to account)?
Simple Image Import and Export Using T-SQL for SQL Server


Please give me a little of your lights !

Have a nice day Smiley Wink

Community Support Team
Community Support Team

Re: Download Files from SQL Server

Hi @Gaëlle 


You need add one new column in your SQL Table, the new column is to store the related file's url.

Then add one Gallery control and one button control in your App,


Button.OnSelect=Download(Gallery2.Selected.src )



More information:





Best Regards.


Level 8

Re: Download Files from SQL Server

Hello @v-yuxima-msft !
First of all, thanks for the time you took to answer me.

Secondly, what will you store under your column "src", and how (when uploading the file)?

I mean, when my user uploads the image in the SQL Server, the file is stored under the FileImage column which is a image type.
The image type only stores the file under hexadecimal code. I do not have the image itself stored anywhere digitally, it is not on the SQL Server harddrive.
I don't have any URL to provide to the src column, neither to the Download function.


So could you please explain to me ?

Super User
Super User

Re: Download Files from SQL Server

Do you want to be able to pick and choose the ones that download and save or all of them?


If you want them all I would do a Flow instead so there is no manually action needed. 


We have on-prem SQL also and I just make the trigger a recurrence and can still update data and run actions from SQL using that. 

Helpful resources


Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Join PowerApps User Group!!

Connect, share, and learn with your peers year-round


Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 189 members 5,536 guests
Please welcome our newest community members: