You can use FileFormatUtil.DetectFileFormat method from Aspose.Word and Aspose.Cells etc. to detect file format. In fact Aspose.Cells method can detect more file formats as compared to Aspose.Words as you can see at http://www.aspose.com/docs/display/cellsnet/Aspose.Cells.FileFormatType+Enumeration
Unknown format will be returned if file is not recognized by any API.
Thank you that was very helpful