excelize icon indicating copy to clipboard operation
excelize copied to clipboard

Increase performance of many DuplicateRow calls

Open AbraaoAlves opened this issue 4 years ago • 1 comments

Description

File.DuplicateRow is a useful method for keep format and styles, but it can be worst if you need to work/duplicate more than 1k rows.

Describe the results you received:

If you run inside a loop 1000 times, File.DuplicateRow can spend 5-6s If you run inside a loop 4000 times, File.DuplicateRow can spend 90-105s !!!

Describe the results you expected: Maybe it's time to create a File.BunchRow(sheetName string, row int, n int) method. This new method can be create a single deepCopy of row and apply it for n rows inserted!

Remember: File.InserRow (adjustHelper internaly) is absurd faster than that.

AbraaoAlves avatar Jan 29 '21 11:01 AbraaoAlves

Sorry for my late reply. If you want to set the styles for multiple rows to keep format and styles, using the SetRowStyle function will get better performance.

xuri avatar May 18 '22 05:05 xuri