c# - Import values from Excel -


i have excel file:

enter image description here

(you can see cell names (or codes) signed red color).

i search way read data on excel template that, in future, in these cells. think of use cell code, don't know how. had tried in way:

public partial class caricadocumento : system.web.ui.page {     protected void page_load(object sender, eventargs e)     {         upload();     }      protected void upload()     {         filestream stream = file.open("c:\\template_p6.xlsx", filemode.open, fileaccess.read);          // reading openxml excel file (2007 format; *.xlsx)         iexceldatareader excelreader = excelreaderfactory.createopenxmlreader(stream);          // data reader methods         while (excelreader.read())         {             int = excelreader.getordinal("ao10"); // doesn't works: throw system.notsupportedexception             var s = excelreader.getvalue(i);             system.console.writeline(s.tostring());         }          //free resources         excelreader.close();     }  } 

i didn't find nothing simple use. have read 3rd-party libraries, prefer avoid using them (if possible).

you can read artical http://www.codeproject.com/tips/696864/working-with-excel-using-csharp , download porject (if signed in)

or read it, if want use openxml.dll open xml excel read cell value


Comments

Popular posts from this blog

How to show in django cms breadcrumbs full path? -

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -