Created
February 11, 2013 20:40
-
-
Save yetanotherchris/4757418 to your computer and use it in GitHub Desktop.
Export to Excel in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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