Read/Write Comment from cell in Excel

Is it possible to read/write comments like we read/write cell values in excel application scope.
Please share if some extra packages need to be included. I have tried with Microsoft.Office.Interlop unable to get right functions to be used.

@sukanyarawal12

From where yo want to Read/Write comments ?

1 Like

From cell in Excel

Hi guys, Is there any update or solution come out?

Hi!. it’s a simple task for Microsoft.Office.Interop.Excel.
Steps:

  • install Microsoft.Office.Interop.Excel from nuget
  • import namespace Microsoft.Office.Interop.Excel to UiPath
  • use my simple project(set your path to Excel File) and excel file for reading comment

ExcelComment.zip (25.9 KB)
testComment.xlsx (9.5 KB)

Hello Ivanco ,

I am not so familiar with C# code you have used in attached xaml. Could you please help me with the If condition , that even if the cell does not have any comment or note it should not throw any error.

Regards,
Akanksha

Hello @pakankshabha
use this simple code for your task:

string myComment;
 if( range.Comment != null)
 {
 	myComment = range.Comment.Text();
 }
 else
 {
 	myComment = "Comment is null!";
 }

Thank you Ivanco for quick reply. I will try this.

Hi @Ivanco

I have a similar issue and the code is not working when the cell is composed of a formula. It’s like the program reads an empty value, but there is a comment and a formula inside it…
Do you may know an alternative please?

Thanks a lot !

Hi @melanie please attach simple example file

Hi Ivanco,

I explained my issue here Copy/Paste Range - #5 by melanie . Thanks