You can use
Interop[
^] to create new instance of MS Excel, open existing file and save data from DataGridViews into it. By saying "save data", i mean: loop through the collection of rows and columns in each grid.
Pseudo code:
j = 3
for r=0 to DataGridView1.Rows.Count -1
for c=0 to DataGridView1.Rows(r).Columns.Count -1
SheetType1.Cells(j, c) = DataGridView1.Cell(r,c).Value
next
j += 1
next
j = 13
for r=0 to DataGridView2.Rows.Count -1
for c=0 to DataGridView2.Rows(r).Columns.Count -1
SheetType1.Cells(j, c) = DataGridView2.Cell(r,c).Value
next
j += 1
next
Note:
As you can see, some piece of code is repeated. There are two changes: DataGridView (respectively DataGridView1 to DataGridView4) on which we operate and starting row in Sheet (
j
). In that case it's strongly recommended to separate this code into procedure or function.
I suggest to read this:
How to automate Microsoft Excel from Visual Basic .NET[
^]
Try! Come back here when you get stuck and ask detailed question.