Domanda

I have a requirement where I'm pulling large amounts of data from SQL Server and will have to insert this data into Excel files.

Now, each excel file must not have more than 1000 rows. These excel files will have to created on the fly.

Please help

È stato utile?

Soluzione

I suggest you wrap your logic in a loop container. Logically, it would look like this:

  • Count the number of rows ready to export to excel. Divide by 1000, round up and set as a variable. (EX. 5049 rows -> 6)
  • Have a loop container loop on the new variable.

    • Within the loop, select the subset of rows by adding a row number to the query (make sure its ordered...) with something like row >= (<variable>-1)*1000 AND row < (<variable>)*1000
    • You can use an expression to name the file with the variable appended to the end to give a unique name. EX. "<filename>_" + DT_WSTR <variable> + ".xls" to get something like dataset_1.xls, dataset_2.xls...
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top