Can not refresh external data in Excel file which connected to Postgres via PowerQuery in Excel Web App
-
06-10-2020 - |
Frage
We have an Excel file which is connected to a postgres database via PowerQuery.
PowerQuery needs npgsql provider for it. When I open file locally on my computer and try to update data - everything is ok.
When I open this excel file in Web App in SharePoint and try to do the same, an error occurs, which ehas no information in the SharePoint ULS logs about it.
I have tried to install npgsql provider on the SharePoint server and added it to Trusted data providers with no result.
So what should I do for resolve the issue? Is it possible?
Or maybe is there another way to connect an Excel file located in SharePoint to Postgres, which I do not know?
Lösung
After weeks of googling and days of waiting for an answer I've wrote my own solution.
I've used C#, SharePoint.Client
and Interoop libraries for Office and Excel.
If you need to update external connections in Excel files (not only PowerQuery) feel free to use it - I've published it on GitHub
Workflow:
- Open local instance of Excel
- Open workbook from SharePoint
- Save it locally in temp file (otherwise file can not be changed, because it is in read only mode)
- Refresh all connections in file
- Save it again
- Publish back to SharePoint site
- Delete temporary file
- Go to 2. if there are other files to update. Else 9
- Close Instance of Excel
There are some issues with authentication, which I described in repository readme
file. And it is not best approach, but it works.