Good afternoon everyone,
I’m trying to use the Invoke Code activity to reference a specific cell and worksheet (in Excel) using the Microsoft.Office.Interop.Excel namespace, but I’ve been having a heck of a time trying to clear up all these error messages.
I know the code isn’t beautiful yet, I’m just hoping to get even a rough draft working for now.
If any of you have worked with the Interop namespace successfully to interact with Excel, any tips or advice would be GREATLY appreciated!
I’ve used it for some simple operations on excel workbooks in VB.NET rather than C#.
Here’s an example to delete specific worksheets in the file:
DeleteWorksheets.xaml (6.6 KB)
Hopefully a working example can help.
Thank you @ronanpeter,
I really appreciate the sample!
I can’t use the Interop because I don’t have excel installed on my server. My work around has been to use ClosedXML.
workbook = New XLWorkbook("....filename.xlsx")
worksheet = workbook.Worksheets.Add("Brad Sheet")
worksheet.Cell("A1").Value = "Brad Bot"
- workbook - in - XLWorkbook
- worksheet - in - IXLWorksheet
You can reference this GitHub if you need anymore examples - https://github.com/ClosedXML/ClosedXML/wiki
This has been extremely helpful for me. Also, this isn’t in C# but you get the idea.