If you can use COM in excel, you can directly request data from excel via COM or create an array of data and transfer it directly to a range equal to the size of your array. Although excel is not suitable for small COM calls, it works pretty well with a few large COM calls :)
DataSet ds = new DataSet(); da.Fill(ds); int width = ds.Tables[0].Columns.Count; int height = ds.Tables[0].Rows.Count; object[,] retList = new object[height, width]; for (int i = 0; i < height; i++) { DataRow r = ds.Tables[0].Rows[i]; for (int j = 0; j < width; j++) retList[i, j] = r.ItemArray[j]; } Excel.Range range = mWs.get_Range(destination, mWs.Cells[destination.Row + height - 1, destination.Column + width - 1]); range.set_Value(Missing.Value, retList); System.Runtime.InteropServices.Marshal.ReleaseComObject(range); range = null;
This is an example of getting data and pasting it as an array in excel in one COM call
source share