The biggest pain when working with files is when they get corrupt. While Office 365 offers a file recovery feature for all its file types, including Word, Excel, and PowerPoint, but if that doesn’t work, it’s a lot of rework. This post will guide you on how you can repair a corrupt Excel workbook and also place backup methods so recovery works better.
Repair & Recover a corrupt Excel Workbook
Follow these two methods to repair a workbook when they show up as corrupted. When you open an Excel file, in such cases, you will get a message that either the file is corrupt or it will not open, or there is no data in the file. Usually, Excel offers a recovery, but if that doesn’t work, you can use the recommended methods.
Repair a corrupted Excel workbook manually
- Open Excel, and click on File and then click on Open.
- Browse and select the file you need to open, but don’t click on the Open button.
- Click on the down arrow next to the Open button, and choose Open and Repair.
- Excel will offer you two options.
- Recover Data (Repair)
- Extract values and formulas from work when repair fails. (Extract Data).
Recover data from a corrupted workbook
Revert the workbook to the last saved version: If the file got corrupt while working on it, it is best to close it without saving it instead of trying to save it with corrupted data. Open it fresh, and it will take you to the state where everything was working.
Save the workbook in SYLK (Symbolic Link) format: In case of printer corruption, save the file as a symbolic link, i.e., the option shows up when you choose to Save as Type > SYLK. Click yes to the prompt, and save the file.
Once done, you will need to reopen the file and save it as an Excel workbook. Since we are saving everything as a new file, the original file is still there. The only drawback of this method is that it will only save the active sheet and not others.
Use a macro to extract data from a corrupted workbook: If the sheet has charts and uses data on the book as a data source, then this macro from Microsoft can help you recover that data.
Sub GetChartValues() Dim NumberOfRows As Integer Dim X As Object Counter = 2
' Calculate the number of rows of data. NumberOfRows = UBound(ActiveChart.SeriesCollection(1).Values) Worksheets("ChartData").Cells(1, 1) = "X Values"
' Write x-axis values to worksheet. With Worksheets("ChartData") .Range(.Cells(2, 1), _ .Cells(NumberOfRows + 1, 1)) = _
Application.Transpose(ActiveChart.SeriesCollection(1).XValues) End With ' Loop through all series in the chart and write their values to
' the worksheet. For Each X In ActiveChart.SeriesCollection Worksheets("ChartData").Cells(1, Counter) = X.Name With Worksheets("ChartData")
.Range(.Cells(2, Counter), _ .Cells(NumberOfRows + 1, Counter)) = _ Application.Transpose(X.Values) End With
Counter = Counter + 1 Next End Sub
To execute the macro, create a new sheet in the Excel file. Then select the chart, and run the macro. The data will become available in the new sheet you created.
How to prevent Workbook corruption
While those methods help when you have a corrupt file, it is best to have a recovery method in place. These are some built-in methods you can enable to make sure you don’t lose files in the future.
Automatically save a backup copy of a workbook:
- Open the worksheet, and then click on File > Save as
- Choose to overwrite the same file, but before that, click on Tools > General.
- Check the box which says Always create a backup.
- Then save the copy.
This will make sure a backup is there every time you want to recover the worksheet.
Automatically create a recovery file at specific intervals:
- Open the worksheet, click on File > Options.
- Under the Save category, configure the following.
- Check the option Save AutoRecover information every and set up the time.
- Setup AutoRecover file location to a place which you know
- Uncheck Disable AutoRecover for this workbook only
I hope the post helped you recover and repair the corrupt Excel Workbook. Always make sure to set up the backup configuration of the files.