SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Remove first two column in excel using Script Task


Remove first two column in excel using Script Task

Author
Message
sqlusers
sqlusers
Old Hand
Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)

Group: General Forum Members
Points: 317 Visits: 512
Hi,
I am converting an Excel File to Flat File [txt file] format. In my excel source file i am getting some unwanted values in first and second rows. Which means that from third row itself i am getting real datas in my excel.

I need to remove those unwanted rows from excel before converting it into an txt file [Flat File format]. How can i do this in Script Task?

---
stricknyn
stricknyn
Mr or Mrs. 500
Mr or Mrs. 500 (556 reputation)Mr or Mrs. 500 (556 reputation)Mr or Mrs. 500 (556 reputation)Mr or Mrs. 500 (556 reputation)Mr or Mrs. 500 (556 reputation)Mr or Mrs. 500 (556 reputation)Mr or Mrs. 500 (556 reputation)Mr or Mrs. 500 (556 reputation)

Group: General Forum Members
Points: 556 Visits: 690
If the "good" data doesn't start until the 3rd column, then you actually don't need a script task to correct this. You can just use an excel source, your transformations in between, and a flat file destination. In your flat file destination you would just ignore the first two columns in the mapping.

Strick



sqlusers
sqlusers
Old Hand
Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)

Group: General Forum Members
Points: 317 Visits: 512
stricknyn (12/1/2010)
If the "good" data doesn't start until the 3rd column, then you actually don't need a script task to correct this. You can just use an excel source, your transformations in between, and a flat file destination. In your flat file destination you would just ignore the first two columns in the mapping.

Strick


But i am getting error while clicking mapping column tab after imporing this into Excel Source part.
Phil Parkin
Phil Parkin
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19257 Visits: 20462
The title of this thread refers to columns, yet your posts refer to rows. That's an important difference - which do you mean?

For future reference, when you get an error and you want to ask the community for help resolving it, please post the text of the error message.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
sqlusers
sqlusers
Old Hand
Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)

Group: General Forum Members
Points: 317 Visits: 512
Phil Parkin (12/2/2010)
The title of this thread refers to columns, yet your posts refer to rows. That's an important difference - which do you mean?

For future reference, when you get an error and you want to ask the community for help resolving it, please post the text of the error message.


Ops, :-) Sorry Phil. I d'nt noticed that. I need rows not columns. But i got the solution for this.

In my data Flow task, i need to set the "OpenRowset" Custom Property in my Excel Source (right-click your Excel connection > Properties; in the Properties window, look for OpenRowset under Custom Properties). To ignore the first 2 rows in Sheet1, and import columns from A-M, i would enter the following value for OpenRowset: Sheet1$A3:M (notice, I did not specify a row number for column M. You can enter a row number if you like. Using my OLEDB Destination i got all the records to my table.

Thank You guyz for your valuable info. :-)
Phil Parkin
Phil Parkin
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19257 Visits: 20462
Nice solution - I'm sure others will use it.

Phil


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search