Library conflict between UiPath.Excel.Workbook and Microsoft.Office.Interop.Excel.Workbook

Hi could I ask a relevant question about Library conflict between “UiPath.Excel.Workbook” and “Microsoft.Office.Interop.Excel.Workbook” when I want to write a C# code to invoke the codes to reformat cells of excel datatable.

After I’ve imported the library “Microsoft.Office.Interop.Excel.Workbook”, I write c# codes like this

// 1. Create a new instance of the Excel application.
Application excelApp = new ApplicationClass();

// 2. Open the Excel file that you want to modify.
Workbook workbook = excelApp.Workbooks.Open("C:\Users\Documents\testdata.xlsx");

// 3. Access the worksheet that contains the cells that you want to reformat.
Worksheet worksheet = workbook.WriteRange("Tabelle1");

// 4. Select the cells that you want to reformat.
Range range = worksheet.Range["B1:C1"];

// 5. Set the number format for the selected cells to "custom".
range.NumberFormat = "0";

Then it came errors about “Test.xaml: No compiled code to run
error CS1009: Unrecognized escape sequence At line 5
error CS0104: ‘Workbook’ is an ambiguous reference between ‘Microsoft.Office.Interop.Excel.Workbook’ and ‘UiPath.Excel.Workbook’ At line 5”

Can I ask for help at this issue? Thank you very much!

Hi @Zhao_Siming

Please use whole namespace instead on only workbook…that should solve the issue