Filter exclude vba/macros in Excel spreadsheet in .NET

Hi Team,

We are allowing user to upload an excel and then use aspose.cells to read the file.

User can write a macro to corrupt the system when file is opened, is there a way to read the excel but disable running of any macro as soon as the file is opened and read using aspose.cells.

Thanks.

@siddhanntarora1992,

Thanks for your query.

Well, you may try to use data filtering options while loading MS Excel file via Aspose.Cells. See the sample code for your reference, it will load everthing in the spreadsheet except vba/macros:
e.g
Sample code:

 var loadFilter = new LoadFilter(LoadDataFilterOptions.All & ~LoadDataFilterOptions.VBA);
            var asposeOptions = new Aspose.Cells.LoadOptions { LoadFilter = loadFilter };
            var wb = new Workbook("e:\\test2\\Book1.xlsx", asposeOptions); 
.......

Moreover, you may try to use Workbook.RemoveMacro() to remove all the macros/vba codes in the workbook, see the sample code for your reference:
e.g
Sample code:

Aspose.Cells.LoadOptions opt = new Aspose.Cells.LoadOptions();
Workbook workbook = new Workbook("e:\\test2\\Book1.xlsx", opt);
            if (workbook.HasMacro)
            {
                workbook.RemoveMacro();
            }
//........
// Your code goes here
//.......

Hope, this helps a bit.