SQL Syntax To Import A Named Range From Excel RRS feed

  • Question

  • Hi,

    For SQL Server 2012+ what could be an appropriate SQL Syntax for importing a named range of an Excel in a New Table.

    • For example consider Excel 2013 file as C:\abc\xyz.xlsx
    • Named Range in the said file as "Named_Range";
    • New Table to be named as "New_Table";
    • The first row contains the field headings;


    Best Regards, Faraz A Qureshi

    Sunday, July 13, 2014 9:14 PM


All replies

  • Deleted
    • Proposed as answer by pituachMVP Sunday, July 13, 2014 11:59 PM
    • Marked as answer by FARAZ A QURESHI Wednesday, July 16, 2014 3:34 AM
    Sunday, July 13, 2014 11:21 PM
  • You can use this as mentioned above....What i would do is 

    INSERT INTO New_Table

                SELECT thefieldsyouwanttoadd

                 FROM OPENROWSET (Bulk 'C:\abc\xyz.xlsx')

    I don't know if this helps but try or might help you do more research. 

    Please remember to click “Mark as Answer” on the post that has answered your question as it is very relevant to other community members dealing with same problem in seeking the right answer

    Sunday, July 13, 2014 11:52 PM