dbTalk Databases Forums  

DTS export to Excel question

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS export to Excel question in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jaryr
 
Posts: n/a

Default DTS export to Excel question - 08-16-2005 , 09:26 AM






How to build a DTS Package so it will generated excel file without column
headers?

Any help is appreciated.

John



Reply With Quote
  #2  
Old   
frank chang
 
Posts: n/a

Default RE: DTS export to Excel question - 08-16-2005 , 10:48 AM






John, This code snippet should be inserted into an Active X Script task at
the beginning of your package:

' Now set the Excel Filename on the Connection
Set oPkg = DTSGlobalVariables.Parent
Set oConn = oPkg.Connections("Connection Summary 1")

oConn.DataSource = DTSGlobalVariables("FileName").Value

oConn.ConnectionProperties("Extended Properties").Value = "Excel
8.0;HDR=NO" ' HDR = YES means generate column header in exported Excel file

Thank you.




"jaryr" wrote:

Quote:
How to build a DTS Package so it will generated excel file without column
headers?

Any help is appreciated.

John




Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS export to Excel question - 08-16-2005 , 01:21 PM



Have a look at this article

Excel treats First Row of Data as Headers
(http://www.sqldts.com/default.aspx?255)




"jaryr" <najyer (AT) hotmail (DOT) com> wrote

Quote:
How to build a DTS Package so it will generated excel file without column
headers?

Any help is appreciated.

John




Reply With Quote
  #4  
Old   
jaryr
 
Posts: n/a

Default Re: DTS export to Excel question - 08-16-2005 , 02:37 PM



Thanks a lot.

The problem is that Extended Properties are HDR=NO and when I try to
force DTS package to generate xls file, the CREATE TABLE script add
headers to newly created Excel file before transformation task pumps
data. If Excel file is already created and doesn't need to be created by
DTS package then it works fine.

Any idea how to overcome this problem?

Again, thank you very much,

John



"frank chang" <frankchang (AT) discussions (DOT) microsoft.com> wrote

Quote:
John, This code snippet should be inserted into an Active X Script task at
the beginning of your package:

' Now set the Excel Filename on the Connection
Set oPkg = DTSGlobalVariables.Parent
Set oConn = oPkg.Connections("Connection Summary 1")

oConn.DataSource = DTSGlobalVariables("FileName").Value

oConn.ConnectionProperties("Extended Properties").Value = "Excel
8.0;HDR=NO" ' HDR = YES means generate column header in exported Excel
file

Thank you.




"jaryr" wrote:

How to build a DTS Package so it will generated excel file without column
headers?

Any help is appreciated.

John






Reply With Quote
  #5  
Old   
jaryr
 
Posts: n/a

Default Re: DTS export to Excel question - 08-16-2005 , 02:42 PM



Yes, I am aware of HDR=YES/NO in Extended Properties of the Excel connection
object.
The problem is that when DTS package has to generate Excel file it creates
additional
task with a script CREATE TABLE .... This task adds headers to Excel file no
matter
what I include in Extended Properties.

Any idea how I can overcome this problem?

Thank you very much,
John


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Have a look at this article

Excel treats First Row of Data as Headers
(http://www.sqldts.com/default.aspx?255)




"jaryr" <najyer (AT) hotmail (DOT) com> wrote in message
news:ugvvW6moFHA.3760 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
How to build a DTS Package so it will generated excel file without column
headers?

Any help is appreciated.

John






Reply With Quote
  #6  
Old   
frank chang
 
Posts: n/a

Default Re: DTS export to Excel question - 08-16-2005 , 04:43 PM



John, I just checked the DTS package I wrote which exports to Excel and I set
HDR = NO in the Extended Properties of the Excel connection and it works
fine. Have you tried Allan Mitchell's other solutions in his article? If it
is OK with you , could you please post excerpts of your Active X Script code?
Also, once the data transformation into your Excel named range, you
can used the Excel COM object model so that the column header never shows.
Thank you.

"jaryr" wrote:

Quote:
Yes, I am aware of HDR=YES/NO in Extended Properties of the Excel connection
object.
The problem is that when DTS package has to generate Excel file it creates
additional
task with a script CREATE TABLE .... This task adds headers to Excel file no
matter
what I include in Extended Properties.

Any idea how I can overcome this problem?

Thank you very much,
John


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eephw8ooFHA.1088 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Have a look at this article

Excel treats First Row of Data as Headers
(http://www.sqldts.com/default.aspx?255)




"jaryr" <najyer (AT) hotmail (DOT) com> wrote in message
news:ugvvW6moFHA.3760 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
How to build a DTS Package so it will generated excel file without column
headers?

Any help is appreciated.

John







Reply With Quote
  #7  
Old   
jaryr
 
Posts: n/a

Default Re: DTS export to Excel question - 08-16-2005 , 05:51 PM



I use Disconnected Edit option to set Extended Properties as per Allan
Mitchell's solution.
When I try to export to existing spreadsheet it works fine, once the
spreadsheet is generated
by my DTS Package, the headers are generated no matter what I set up in in
Extended Properties.

In the DTS Package you wrote are you exporting to exsisting spreadsheet?

Thanks,
John


"frank chang" <frankchang (AT) discussions (DOT) microsoft.com> wrote

Quote:
John, I just checked the DTS package I wrote which exports to Excel and I
set
HDR = NO in the Extended Properties of the Excel connection and it works
fine. Have you tried Allan Mitchell's other solutions in his article? If
it
is OK with you , could you please post excerpts of your Active X Script
code?
Also, once the data transformation into your Excel named range, you
can used the Excel COM object model so that the column header never
shows.
Thank you.

"jaryr" wrote:

Yes, I am aware of HDR=YES/NO in Extended Properties of the Excel
connection
object.
The problem is that when DTS package has to generate Excel file it
creates
additional
task with a script CREATE TABLE .... This task adds headers to Excel file
no
matter
what I include in Extended Properties.

Any idea how I can overcome this problem?

Thank you very much,
John


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eephw8ooFHA.1088 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Have a look at this article

Excel treats First Row of Data as Headers
(http://www.sqldts.com/default.aspx?255)




"jaryr" <najyer (AT) hotmail (DOT) com> wrote in message
news:ugvvW6moFHA.3760 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
How to build a DTS Package so it will generated excel file without
column
headers?

Any help is appreciated.

John









Reply With Quote
  #8  
Old   
frank chang
 
Posts: n/a

Default Re: DTS export to Excel question - 08-16-2005 , 06:24 PM



John, In the test I just did, I am trying to export the result of a SQL
Server query to a named range on a new Excel worksheet. I create the Excel
worksheet using an Excel COM object method in a DTS Task just before the DTS
Data Transformation Task. Before the DTS package runs, no Excel spreadsheet
exists. The name of the new excel worksheet is "ABCDEFG" + today's date and
time + ".xls". However, my package is slightly different than yours in that I
am trying to export to a named range on this new spreadsheet.
I know that you can avoid having to deal with Extended Properties,
if you move the data around on your exported Excel spreadsheet , after the
DTS Data Transformation Task, using an Excel COM Object model method so that
the column headers are overwritten. I don't know what your constraints and
specifications are so I don't know if this will help you. Thank you.

"jaryr" wrote:

Quote:
I use Disconnected Edit option to set Extended Properties as per Allan
Mitchell's solution.
When I try to export to existing spreadsheet it works fine, once the
spreadsheet is generated
by my DTS Package, the headers are generated no matter what I set up in in
Extended Properties.

In the DTS Package you wrote are you exporting to exsisting spreadsheet?

Thanks,
John


"frank chang" <frankchang (AT) discussions (DOT) microsoft.com> wrote in message
news:F5F1E1B2-840F-40AE-9773-EB59996BBA06 (AT) microsoft (DOT) com...
John, I just checked the DTS package I wrote which exports to Excel and I
set
HDR = NO in the Extended Properties of the Excel connection and it works
fine. Have you tried Allan Mitchell's other solutions in his article? If
it
is OK with you , could you please post excerpts of your Active X Script
code?
Also, once the data transformation into your Excel named range, you
can used the Excel COM object model so that the column header never
shows.
Thank you.

"jaryr" wrote:

Yes, I am aware of HDR=YES/NO in Extended Properties of the Excel
connection
object.
The problem is that when DTS package has to generate Excel file it
creates
additional
task with a script CREATE TABLE .... This task adds headers to Excel file
no
matter
what I include in Extended Properties.

Any idea how I can overcome this problem?

Thank you very much,
John


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eephw8ooFHA.1088 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Have a look at this article

Excel treats First Row of Data as Headers
(http://www.sqldts.com/default.aspx?255)




"jaryr" <najyer (AT) hotmail (DOT) com> wrote in message
news:ugvvW6moFHA.3760 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
How to build a DTS Package so it will generated excel file without
column
headers?

Any help is appreciated.

John










Reply With Quote
  #9  
Old   
jaryr
 
Posts: n/a

Default Re: DTS export to Excel question - 08-16-2005 , 07:16 PM



I have to create a generic server side component (in VB 6) which will export
data from SQl 2K server to excel file by building DTS package at runtime.
There are no Excel objects on the server so the approach you are using is
not an option for me, Microsoft.JET.OLEDB.4.0 is the only available thing I
can use.

Looks like I have two options:
1. Generate empty Excel template file and just before generating DTS package
copy it and use a copy as a export destination file.
2. Forget about option of exporting to Excel with no column headers.

Thank you very much for all you help,
John



"frank chang" <frankchang (AT) discussions (DOT) microsoft.com> wrote

Quote:
John, In the test I just did, I am trying to export the result of a SQL
Server query to a named range on a new Excel worksheet. I create the
Excel
worksheet using an Excel COM object method in a DTS Task just before the
DTS
Data Transformation Task. Before the DTS package runs, no Excel
spreadsheet
exists. The name of the new excel worksheet is "ABCDEFG" + today's date
and
time + ".xls". However, my package is slightly different than yours in
that I
am trying to export to a named range on this new spreadsheet.
I know that you can avoid having to deal with Extended Properties,
if you move the data around on your exported Excel spreadsheet , after the
DTS Data Transformation Task, using an Excel COM Object model method so
that
the column headers are overwritten. I don't know what your constraints and
specifications are so I don't know if this will help you. Thank you.

"jaryr" wrote:

I use Disconnected Edit option to set Extended Properties as per Allan
Mitchell's solution.
When I try to export to existing spreadsheet it works fine, once the
spreadsheet is generated
by my DTS Package, the headers are generated no matter what I set up in
in
Extended Properties.

In the DTS Package you wrote are you exporting to exsisting spreadsheet?

Thanks,
John


"frank chang" <frankchang (AT) discussions (DOT) microsoft.com> wrote in message
news:F5F1E1B2-840F-40AE-9773-EB59996BBA06 (AT) microsoft (DOT) com...
John, I just checked the DTS package I wrote which exports to Excel and
I
set
HDR = NO in the Extended Properties of the Excel connection and it
works
fine. Have you tried Allan Mitchell's other solutions in his article?
If
it
is OK with you , could you please post excerpts of your Active X Script
code?
Also, once the data transformation into your Excel named range,
you
can used the Excel COM object model so that the column header never
shows.
Thank you.

"jaryr" wrote:

Yes, I am aware of HDR=YES/NO in Extended Properties of the Excel
connection
object.
The problem is that when DTS package has to generate Excel file it
creates
additional
task with a script CREATE TABLE .... This task adds headers to Excel
file
no
matter
what I include in Extended Properties.

Any idea how I can overcome this problem?

Thank you very much,
John


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eephw8ooFHA.1088 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Have a look at this article

Excel treats First Row of Data as Headers
(http://www.sqldts.com/default.aspx?255)




"jaryr" <najyer (AT) hotmail (DOT) com> wrote in message
news:ugvvW6moFHA.3760 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
How to build a DTS Package so it will generated excel file without
column
headers?

Any help is appreciated.

John












Reply With Quote
  #10  
Old   
frank chang
 
Posts: n/a

Default Re: DTS export to Excel question - 08-17-2005 , 07:26 AM



John, Before you implement your template approach, please check with Allan
Mitchell. Finally, I have seen many production SQL Server(i.e database
server) instances which also have Microsoft Excel installed. I am curious why
Microsoft Excel is not allowed on your SQL Server. Once Microsoft Excel is
installed, you automatically get the Excel COM Object.

"jaryr" wrote:

Quote:
I have to create a generic server side component (in VB 6) which will export
data from SQl 2K server to excel file by building DTS package at runtime.
There are no Excel objects on the server so the approach you are using is
not an option for me, Microsoft.JET.OLEDB.4.0 is the only available thing I
can use.

Looks like I have two options:
1. Generate empty Excel template file and just before generating DTS package
copy it and use a copy as a export destination file.
2. Forget about option of exporting to Excel with no column headers.

Thank you very much for all you help,
John



"frank chang" <frankchang (AT) discussions (DOT) microsoft.com> wrote in message
news:450D3ABA-C8BF-4589-875F-52D7B096437A (AT) microsoft (DOT) com...
John, In the test I just did, I am trying to export the result of a SQL
Server query to a named range on a new Excel worksheet. I create the
Excel
worksheet using an Excel COM object method in a DTS Task just before the
DTS
Data Transformation Task. Before the DTS package runs, no Excel
spreadsheet
exists. The name of the new excel worksheet is "ABCDEFG" + today's date
and
time + ".xls". However, my package is slightly different than yours in
that I
am trying to export to a named range on this new spreadsheet.
I know that you can avoid having to deal with Extended Properties,
if you move the data around on your exported Excel spreadsheet , after the
DTS Data Transformation Task, using an Excel COM Object model method so
that
the column headers are overwritten. I don't know what your constraints and
specifications are so I don't know if this will help you. Thank you.

"jaryr" wrote:

I use Disconnected Edit option to set Extended Properties as per Allan
Mitchell's solution.
When I try to export to existing spreadsheet it works fine, once the
spreadsheet is generated
by my DTS Package, the headers are generated no matter what I set up in
in
Extended Properties.

In the DTS Package you wrote are you exporting to exsisting spreadsheet?

Thanks,
John


"frank chang" <frankchang (AT) discussions (DOT) microsoft.com> wrote in message
news:F5F1E1B2-840F-40AE-9773-EB59996BBA06 (AT) microsoft (DOT) com...
John, I just checked the DTS package I wrote which exports to Excel and
I
set
HDR = NO in the Extended Properties of the Excel connection and it
works
fine. Have you tried Allan Mitchell's other solutions in his article?
If
it
is OK with you , could you please post excerpts of your Active X Script
code?
Also, once the data transformation into your Excel named range,
you
can used the Excel COM object model so that the column header never
shows.
Thank you.

"jaryr" wrote:

Yes, I am aware of HDR=YES/NO in Extended Properties of the Excel
connection
object.
The problem is that when DTS package has to generate Excel file it
creates
additional
task with a script CREATE TABLE .... This task adds headers to Excel
file
no
matter
what I include in Extended Properties.

Any idea how I can overcome this problem?

Thank you very much,
John


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eephw8ooFHA.1088 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Have a look at this article

Excel treats First Row of Data as Headers
(http://www.sqldts.com/default.aspx?255)




"jaryr" <najyer (AT) hotmail (DOT) com> wrote in message
news:ugvvW6moFHA.3760 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
How to build a DTS Package so it will generated excel file without
column
headers?

Any help is appreciated.

John













Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.