excelize
excelize copied to clipboard
Increase performance of many DuplicateRow calls
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.
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.