We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exist Formula and Macros in worksheet?

Hello there,

I have to check if user have used formulas in a worksheet?? Is it possible???

And another question, I can check if macros exist in a workbook but can I check if aworksheet contains macros???

Thanks in advance


Thank you for contacting Aspose support.

Regarding the first part of your inquiry, you can use the Find feature of Aspose.Cells APIs to check if a given worksheet has any formula in its cells. Please check the following piece of code and attached input spreadsheet for your reference.


var book = new Workbook(dir + “book1.xls”);
var cells = book.Worksheets[0].Cells;
FindOptions opts = new FindOptions();
opts.LookInType = LookInType.OnlyFormulas;
opts.LookAtType = LookAtType.StartWith;
Cell cell = null;
cell = cells.Find("=", cell, opts);
if (cell != null)
} while (cell != null);

Regarding the detection of macros, you have to use the Workbook.HasMacro property to check if a spreadsheet has macros or not. Unfortunately, this feature is not available at worksheet level.