Create Excel XLS from T-SQL (Append)

  • I would like to use formatted a Excel worksheet to insert my data through linked server, however when I insert the line is placed below of the formatted lines. How can I solve this ? It has one another solution to format the worksheet?

    thanks

    anderson

  • Can you post what you have so far?

    Another approach might be, to use MsQuery (comes along with Office, but isn't installed by default) to query SQL Server. I use this frequently, but I always have a basic raw data sheet where the result set from the query is placed. And then other sheets which I use for printouts that link to this basic sheet.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • anderson,

    Have you simply tried a direct insert using the OPENDATASOURCE syntax?

    INSERT INTO OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0'

        ,'Data Source="<FilePath>.xls";User ID=Admin;Password=;Extended properties=Excel 8.0'

        )...Sheet1$

    (Field1, Field2)

    SELECT Field1, Field2

    FROM Foo

     




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply