locked
Formatting in Excel when Export through OPENROWSET 'Microsoft.ACE.OLEDB.12.0' RRS feed

  • Question

  • Hi ,

    I am using below command for exporting data into excel .

    insert into OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=D:\Test\DailyReport.xlsx;Extended Properties="Excel 12.0 Xml;HDR=YES";', 'SELECT [CircleCode],[CircleName] FROM [Sheet2$]')

    Select CircleCode,CircleName from TableName

    But I want Border for inserted record in excel .

    Is it possible ...............

    Pls help 


    Akhilesh Sahu Sr.Software Developer

    Tuesday, April 8, 2014 12:13 PM

Answers

  • Hi Alberto Morillo,

    Thx for reply .Whenever I inserted record in excel ,I want border for those record in excel ,like below image. 


    Akhilesh Sahu Sr.Software Developer


    Hi akhilesh sahu,

    According to your description, you can only  export data from SQL Server to Excel via the OPENROWSET command, it does not included any border. After you insert data into Excel, you can add cell borders in Excel directly, For more information, see: How to Add Cell Borders in Excel 2010.

    Regards,
    Sofiya Li


    Sofiya Li
    TechNet Community Support

    • Marked as answer by Sofiya Li Monday, April 14, 2014 2:57 AM
    Wednesday, April 9, 2014 7:53 AM

All replies

  • Hello,

    Please explain a little bit more what you would like to achieve.  


    Regards,

    Alberto Morillo
    SQLCoffee.com

    Tuesday, April 8, 2014 1:58 PM
  • Hi Alberto Morillo,

    Thx for reply .Whenever I inserted record in excel ,I want border for those record in excel ,like below image. 


    Akhilesh Sahu Sr.Software Developer

    Wednesday, April 9, 2014 4:40 AM
  • Hi Alberto Morillo,

    Thx for reply .Whenever I inserted record in excel ,I want border for those record in excel ,like below image. 


    Akhilesh Sahu Sr.Software Developer


    Hi akhilesh sahu,

    According to your description, you can only  export data from SQL Server to Excel via the OPENROWSET command, it does not included any border. After you insert data into Excel, you can add cell borders in Excel directly, For more information, see: How to Add Cell Borders in Excel 2010.

    Regards,
    Sofiya Li


    Sofiya Li
    TechNet Community Support

    • Marked as answer by Sofiya Li Monday, April 14, 2014 2:57 AM
    Wednesday, April 9, 2014 7:53 AM