GetOleDbSchemaTable - Extract Excel Column names RRS feed

  • Question

  • I am being slowly driven crazy trying to get a list of Excel column names using GetOleDbSchemaTables.  What I am trying to do is develop a simple VB.NET Application where the user will select an Excel Spreadsheet, and I will 'query' its schema and fill a listbox with Column names in the Spreadsheet.

    I thought this would be a fairly easy task and I downloaded two KB articles, KB257819 and Q318373 - astonishingly, the code presented in BOTH of these articles simply does not work.  In one of them its bugged because two values used are not defined at all, and in the other, the code runs but returns 0 for tables (thats, zero for # of tables, where in fact there is 1 in the Spreadsheet).

    Does anyone have any simple code (ADO or OLEdb) for doing this (what should be) simple task?

    Again, all I want to do is query the metadata and get a dataset (or arraylist, whatever) of the column names.

    Any help would be GREATLY appreciated!!!

    - Beebo
    • Moved by Cindy Meister MVP Wednesday, November 5, 2008 6:47 PM not about the VSTO technology (Moved from Visual Studio Tools for Office to Off-Topic Posts (Do Not Post Here))
    Wednesday, November 5, 2008 6:23 PM


All replies