locked
SQL Query to find sheet names in a excel file RRS feed

  • Question

  • Query to retreive the SheetNames in a Excel File?

    The resultset should be

    Filename               SheetName
    Excel File 1             Sheet1$
    Excel File 1             Sheet2$
    and so on
    Friday, March 12, 2010 2:17 AM

Answers

  • May be you are looking for reading the sheet names from a given excel file

    Establish a linked server to the excel file

    EXEC sp_addlinkedserver 'ExcelShare',
       'Jet 4.0',
       'Microsoft.Jet.OLEDB.4.0',
       '\\MyServer\MyShare\Spreadsheets\DistExcl.xls',
       NULL,
       'Excel 5.0'

    Then you can use sp_tables_ex procedure to read the sheet names in the excel file
    Friday, March 12, 2010 5:54 AM

All replies

  • Question not clear.
    this might help you
    http://msdn.microsoft.com/en-us/library/aa260689(SQL.80).aspx


    The Deutsche will take on to Kangaroo's in Hockey finals
    Friday, March 12, 2010 4:24 AM
  • May be you are looking for reading the sheet names from a given excel file

    Establish a linked server to the excel file

    EXEC sp_addlinkedserver 'ExcelShare',
       'Jet 4.0',
       'Microsoft.Jet.OLEDB.4.0',
       '\\MyServer\MyShare\Spreadsheets\DistExcl.xls',
       NULL,
       'Excel 5.0'

    Then you can use sp_tables_ex procedure to read the sheet names in the excel file
    Friday, March 12, 2010 5:54 AM