Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert a row in one go with EPPlus

I've started using EPPlus and I was wondering if there is a way to insert a row all in one go instead of having to populate cell by cell.

For example let's say my row number 6 is populated with various number, could I insert all cells in the row by separating the values with something like a comma or a tab? Something like:

ws.Row(6).Value = "12,45,76,12,1";

(I know the syntax above doesn't work, just wondering if there is a way to do something similar). Thank you!

like image 255
Gep Avatar asked Feb 07 '23 13:02

Gep


1 Answers

You mean like this:

ws.Cells[6, 1].LoadFromText("12,45,76,12,1");

The Cells object has an overload to specify Row, Column. LoadFromText has 5 overloads so you can get very specific on how it loads the text. The above will give this:

enter image description here

like image 100
Ernie S Avatar answered Feb 13 '23 20:02

Ernie S