wps excel

ET.Application etApp;
ET.workbook etbook;
ET.Worksheet etsheet ;
ET.Range etrange;
//获取工作表表格
etApp = new ET.Application();
etbook = (ET.workbook)etApp.Workbooks.Open(@"c:file.xls");

//获取数据区域
etsheet = (ET.Worksheet)etbook.Worksheets.get_Item(1);

//获取数据区域 
etrange = (ET.Range)etsheet.UsedRange;

4. 读取某单元格的数据内容:

string strData = ((ET.Range)etrange.get_Item(i, j)).Text;

5. 写入某单元格的数据内容:

((ET.Range)etrange.get_Item(i, j)).Value = strData;

6. 关闭文件及相关资源:

etbook.Close();
etApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(etrange);
System.Runtime.InteropServices.Marshal.ReleaseComObject(etsheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(etbook);
System.Runtime.InteropServices.Marshal.ReleaseComObject(etApp);

原文地址:https://www.cnblogs.com/jiujian-sk/p/9640001.html