Hi,
Thanks for your posting and considering Aspose.Cells.
FileFormatUtil.DetectFileFormat() method should fit your needs. Please check the attached abc.txt file. It is actually an xlsb file. If you change its extension to xlsb, it will open up in Microsoft Excel.
Please see the following code and its console output. The code successfully detects the actual format of abc.txt file.
Please also see the following documentation article for your reference.
( How to Detect a File Format and Check if the File is Encrypted|Documentation )
C#
//Detect file format
FileFormatInfo info = FileFormatUtil.DetectFileFormat(“abc.txt”);
//Gets the detected load format
Console.WriteLine("The spreadsheet format is: " + FileFormatUtil.LoadFormatToExtension(info.LoadFormat));
//Check if the file is encrypted.
Console.WriteLine("The file is encrypted: " + info.IsEncrypted);
Console Output:
The file is encrypted: False