4

I have a data flow task which contain excel file as the source and script component as the destination.

Is there a way to get the number of rows in my excel file and pass it my script component?

I already tried with Row count component but its value gets updated only after the data flow task is done.

Hadi
  • 36,233
  • 13
  • 65
  • 124
Santosh
  • 101
  • 1
  • 2
  • 10
  • I had posted an answer for a similar question looking for row counts of a file. You should be able to use the same code to get what you are looking for. http://stackoverflow.com/questions/39127648/ssis-matching-csv-file-to-control-file-before-loading-to-destination/39136146#39136146 – Chris Albert May 12 '17 at 16:52

2 Answers2

1

if you want to use Row Count component you have to create two dataflow tasks:

  • the first only contains Excel Source + Row Count component
  • the second contains Excel Source + Derived Column + Destination

The derived column is used to add the variable that store the row count as a new column

More info in this question Does variable value set by Row Count Transformation take effect during execution of DFT in SSIS? or Conditional Split can read a variable correctly?

Community
  • 1
  • 1
Hadi
  • 36,233
  • 13
  • 65
  • 124
  • This what I actually did but I just stored the result of Row Count Component into a variable with scope package and just access it in my script component. – Santosh May 15 '17 at 09:46
0

You can use a script task before the dataflow that counts the rows in the Excel file and stores it in a variable.

Tab Alleman
  • 31,483
  • 7
  • 36
  • 52