Excel issue- data corrupted

I am getting the below error while reading the excel file-
Excel Application Scope: Excel cannot open the file ‘~$abc.xlsx’ because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.

I also tried to use read workbook but still getting an error.

Please let me know, if you have any solution for this.



I guess you passed wrong file name. See the file name contains special characters and all.

I am just using write line to check file name and this is the name I am getting in console.

This is a something Microsoft Office does. When you edit a file, it occasionally saves temporary copies with the string “~$” attached to its front. Special characters are not generally allowed in file names. It uses this to offer you a recovery option to a previous version if your system crashes or an unexpected error occurs. If you could give some context to your process, maybe someone could give you an alternative to the way you’re going about it? Maybe you should skip over such files.

1 Like


As @rpa4 said you need to skip those files. Check if file name contains that dollar symbol then skip that file and go to next file.