c# console app read excel sheet and remove rows based on contents

I have been reading up on ways to read a CSV File in C# and I have heard that it is really complicated. What I am looking to do is have a console read a csv and if there are cells in column A that contain 123 it will delete all rows with a cell in column A with 123. BUT, as it does this all.. I need it to save to ANOTHER excel file so I have the original file as well. This is what I have to read the file. Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; Excel.Range range; string str; int rCnt = 0; int cCnt = 0; xlApp = new Excel.ApplicationClass(); xlWorkBook = xlApp.Workbooks.Open("123abc.csv", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

以上就是c# console app read excel sheet and remove rows based on contents的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » excel

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏