0

I need to add a row in excel sheet before the last row in epplus. So far I got:

 ws.InsertRow(ds.Tables(0).Rows.count-1,1)

However this code adds a cell on Fist column. How do I add for entire columns? Is there any way to add a row for entire columns? how ?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Not entirely sure I understand your issue. The InsertRow command as you show should have added a row at the end. From there you should be able to ws.Cells(1,s.Tables(0).Rows.count-1).Value = "whatever". Syntax might be slightly off, doing from memory.... That would put whatever in the last rows, first column. – Kevin LaBranche Aug 30 '18 at 19:21
  • Thanks @klabranche ... – Thaman Gurung Aug 31 '18 at 20:16
  • Uhhhhh!! I was writing ugly code.... Just moved outside of loop for row fixed the problem! – Thaman Gurung Aug 31 '18 at 20:19

0 Answers0