Import multiple xlsx files

86 views
Skip to first unread message

Daniele Bilancione

unread,
Jul 11, 2023, 4:57:10 PM7/11/23
to Excel-DNA
Hi,

I am pretty new to Excel-DNA; I do not know how to browse the library so I thought of dropping a message here in this group.

I have an Excel application developed with VBA which I wish to convert to an Add-In using C# - I thought it might be a good exercise starting from something I developed.

Basically with this application the user selects n Excel files to imports via a custom ribbon tab; each file contains 2 worksheets and the application combine the information on both to create a single worksheet which will then copied into the workbook, thus closing the workbook where the information were collected without saving it. Once all files have been imported, another sub (triggered by a different button in the custom ribbon tab) combine all the imports in a single worksheets and compare the information, using conditional formatting to highlight differences.

In VBA I used a FileDialog object to import the xlsx files. Is there anything similar in Excel-DNA I could use?

:)

Kedar Kulkarni

unread,
Jul 14, 2023, 11:59:29 AM7/14/23
to Excel-DNA
you can check https://www.c-sharpcorner.com/UploadFile/mahesh/openfiledialog-in-C-Sharp/  (it use System.Windows.Forms)

There are many open source addins on Github that use excel dna and you could check those addins to explore (or excel dna git hub site as well).

The task that you mentioned could be done using powerquery so if you are looking for a quick and dirty solution - you could use powerquery if on office 365/2016+.  https://support.microsoft.com/en-us/office/import-data-from-a-folder-with-multiple-files-power-query-94b8023c-2e66-4f6b-8c78-6a00041c90e4

Excel DNA has a bit of learning curve and transition from VBA to C# itself takes dedicated months. Best of luck
thanks,
Reply all
Reply to author
Forward
0 new messages