Hello Sascha Neffe,
Thank you for reaching out to Microsoft Q&A forum and providing detailed information about the issue you're experiencing with your Excel add-in. From what I've looked into and tested, this seems to be related to how the OLEDB provider handles Excel files, it's not just grabbing the actual worksheets, but also picking up on named ranges that Excel creates behind the scenes for things like tables, filters, or print areas. Newer Excel updates might be generating more of these automatically, which could explain why you're seeing duplicates now. It's not listed as a specific change in that version, but it's a common quirk we've heard about in dev forums, especially with the older 12.0 provider. To resolve this and restore functionality to your add-in, here's what I'd suggest trying:
- Update Your Schema Filtering Logic: Modify your code to target only true worksheet names, which typically end with a
$(e.g., "Sheet1$"). Exclude internal ranges (often containing_). Here's an adjusted version of your provided code:
This should cut out the duplicates. Do the same kind of filtering for columns if needed.public void PublishAll_OnClick(IRibbonControl control) { using var connection = new OleDbConnection($"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"{Globals.ThisAddIn.Application.ActiveWorkbook.FullName}\";Persist Security Info=False;Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1\""); connection.Open(); var tables = new List<string>(); using var tableSchemas = connection.GetSchema("TABLES"); foreach (DataRow row in tableSchemas.Rows) { var tableType = (string)row["TABLE_TYPE"]; if (!string.Equals(tableType, "TABLE")) continue; var tableName = (string)row["TABLE_NAME"]; if (tableName.EndsWith("$") && !tableName.Contains("_")) // Targets actual sheets, skips internals { tables.Add(tableName.TrimEnd('\'').TrimEnd('$')); // Clean name for use (e.g., "Sheet1") } } // Proceed with unique tables list } - Upgrade to a Newer OLEDB Provider: Switch to Microsoft.ACE.OLEDB.16.0, which is more compatible with recent Excel builds. Download the Microsoft Access Database Engine 2016 Redistributable (match 32-bit/64-bit to your Office installation) Update your connection string accordingly:
Provider=Microsoft.ACE.OLEDB.16.0;Data Source=\"{path}\";Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\";
You can also submit feedback directly through Excel's Help > Feedback menu to help prioritize potential fixes.
I hope this information will be helpful to your situation, in case you have any additional concern, feel free to comment below. I be more than happy to assist.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.