I try to display data using Excel services in a web part. First of all, my Sharepoint version is Sharepoint 2013; In addition, all authentication processes are working properly and I can retrieve the data. My excel is set to refresh connection each time the page is opened. Where my problem starts is that when I open the page, I get a warning: "Be careful. This workbook contains one or more queries that might be unsafe". I have searched about it found some solutions from: https://docs.microsoft.com/en-us/sql/analysis-services/power-pivot-sharepoint/this-workbook-contains-one-or-more-queries-that-refresh-external-data?view=sql-analysis-services-2017 and from : http://dinushaonline.blogspot.com.tr/2016/01/disable-warning-query-and-refresh-data.html
Creating a Trusted file location; I have done this, but did not solve my problem.
To disable warnings ( "In External Data, clear the checkbox for Warn on data refresh." ). This solution removed the warning however it made a side effect. After disabling the warning, my Excel does not refresh data automatically when the page is opened. Now it refresh only when the user click to refresh manually. I would like to ask if there is any solution for that? Briefly, I want to refresh my data connection each time the page is opened, also do not want to get "Be careful. This workbook contains one or more queries that might be unsafe" error displaying to the user. User should see the most recent data without on the page load automatically without clicking anywhere.
Thank you in advance.