Forum Discussion
Office 365 - Delete data connections in one go
- Feb 04, 2018
you can use this vbscript in a Macro button:
Sub Remove() Dim connection As WorkbookConnection Dim query As WorkbookQuery On Error Resume Next For Each connection In ThisWorkbook.Connections connection.Delete Next For Each query In ThisWorkbook.Queries query.Delete Next End Sub
In Get Data -> Edit queries you can select several queries for deletion, and the same for connection permissions in Get Data -> Data Source settings
So from Data -> Get Data, I get no Edit. Data Source Settings are available and I can select multiple queries (not, e.g. SQL Server connections) but not actually delete them. When I select multiple. I can press delete but that goes to Clear Permissions. I can change permissions or, individually of course, change the Source.
Could you share a screenprint?
- Pablo R. OrtizFeb 06, 2018Steel Contributor
BTW what Office 365 license are you using with this?
- Jaron RoseggFeb 06, 2018Copper Contributor
Office 365, Version 1801 (Build 9001.2138 Click-to-Run).
So yes, through Data -> Get Data -> Launch Query Editor, I can indeed select multiple Queries and delete them. Thanks! It is rather easier in Office 2016 though.
With Data Source Settings though, I can only delete permissions, not the actual Queries. Connections do not show up in either (tested with odc connections to SQL Server).
- Pablo R. OrtizFeb 06, 2018Steel Contributor
Good! I can view my odc connections in:
C:\Users\myuser\Documents\Mis archivos de origen de datos
So "Mis archivos de origen de datos" is like "My data source files". Find that folder on File Explorer.
- Pablo R. OrtizFeb 06, 2018Steel Contributor
It's in Spanish, but you can get the idea. If you select Query editor (first red marked option) Power Query editor opens and you can select multiple queries. If you select Data Source settings you can delete permissions for several connections in current Workbook or Globally.