Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Export to Excel in C#
var app = new ApplicationClass();
var book = app.Workbooks.Open(@"C:\test.xlsx", false, false, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
var sheet = (Worksheet) book.Worksheets[1];
var range = sheet.get_Range("D7", "D127");
var cell = (Range) range.Cells[1, 1]; // all indexes are 1 based. This gets the first row, column
string val = cell.Value2.ToString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.