A recent requirement is to import data from many Excel tables to the database. Because each excel table only contains one record (instead of one record per row in an Excel table ), therefore, you cannot export data directly.
It was easy and pleasant to do this in VB: Introduce Excel objects, then new application, new workbook, read cell or range. At the beginning, I thought: it should be difficult to solve this problem with COM InterOP after being transferred to. net. But how can I use Visual Studio Tools for office (vsto) that Microsoft promotes? Read someArticleIt started, and found that it was quite simple... Wait, how is the class structure similar to the class name? Switch back to the common project, introduce the Excel objects com reference, and do something similar. Finally, we found that vsto is the original InterOP repackaging of Excel objects (or office objects ~~~ Microsoft's market department is still able to make great strides.
If you have previous experience in VB development office or VBA Development Office, it will be very comfortable to switch to vsto, and everything is basically unchanged. However, the optional parameters must be replaced by system. type. Missing.