how to copy many rows by cloning an existing row ?

Topics: Developer Forum, Project Management Forum, User Forum
Aug 23, 2012 at 7:47 AM

 I set some value to some cells in row 1,and I want to know how to clone row 1 and copy another 1999 rows ?

 

Now,i only know a way by cloning a cell 2000 times to solve this problem.

Coordinator
Aug 23, 2012 at 9:55 AM

Use toArray() method to create a copy of your first row

Then use fromArray 1,999 times to populate the additional 1,999 rows.... at least you don't have to do it cell by cell

Aug 24, 2012 at 2:48 AM
MarkBaker wrote:

Use toArray() method to create a copy of your first row

Then use fromArray 1,999 times to populate the additional 1,999 rows.... at least you don't have to do it cell by cell

Thank you a lot for replying!

Actually,what i am doing  is to load an Excel.xls and read some strings from Mysql ,and set these strings to the DropDown value of some cells using method 'setFormula1'.

If i set the DropDown value of some cells of the first row of a sheet,then i use the toArray() method to make an array,then i make a new 2D array with 2000 rows copying the former array with just one row.

I then use the method FromArray() method to set the sheet 'sheet1'.

If i do these above,will the cells of the 2000 rows of  sheet 'sheet1' all have the DropDown value ?

I am waiting for ur help,thanks again !

Coordinator
Aug 24, 2012 at 5:23 PM

No they won't because the array is being used for data population of the cells, and the dropdown validation isn't data... you'll need to clone the validation list to each cell where it needsapplying

Aug 27, 2012 at 1:49 AM
MarkBaker wrote:

No they won't because the array is being used for data population of the cells, and the dropdown validation isn't data... you'll need to clone the validation list to each cell where it needsapplying

Many Thanks!

Is there a way to clone a validation of an entire row and  then copy to other rows ? I will get a low efficiency if i clone the validation by each cell.

Aug 28, 2012 at 3:35 AM
Gabrielfulexs wrote:
MarkBaker wrote:

No they won't because the array is being used for data population of the cells, and the dropdown validation isn't data... you'll need to clone the validation list to each cell where it needsapplying

Many Thanks!

Is there a way to clone a validation of an entire row and  then copy to other rows ? I will get a low efficiency if i clone the validation by each cell.

 

where are you,MarkBaker ?

Coordinator
Aug 28, 2012 at 6:36 AM

I apologise for taking a UK Bank Holiday weekend off so that I wasn't here when you needed me

 

There isn't a way to clone the validation of an entire row. I've already outlined the best way to copy the data, but there is no simple method available to clone a row with all its formattting or validations or conditional formatting.

Aug 28, 2012 at 8:52 AM
MarkBaker wrote:

I apologise for taking a UK Bank Holiday weekend off so that I wasn't here when you needed me


rotfl

welcome back Mark :)

Sep 3, 2012 at 10:10 AM
MarkBaker wrote:

I apologise for taking a UK Bank Holiday weekend off so that I wasn't here when you needed me

 

There isn't a way to clone the validation of an entire row. I've already outlined the best way to copy the data, but there is no simple method available to clone a row with all its formattting or validations or conditional formatting.

Thank you very much.~