c# - How to open excel file and rename excel worksheet? -
ok, i've search other questions regarding topic have not yet found answer. need read excel file , rename excel worksheet programmatically. i'm using 2007 excel. help? tip?
personally, i'd use free library such epplus this. think cleaner , easier use interop.
something this:
fileinfo finfo = new fileinfo(@"c:\temp\book1.xlsx"); using (var excelpackage = new excelpackage(finfo)) { excelworksheet ws = excelpackage.workbook.worksheets["sheet1"]; ws.name = "newworksheet name"; excelpackage.save(); }
Comments
Post a Comment