Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Salvage a possibly corrupt notebook file by extracting all valid cells from it
ResourceFunction["SalvageNotebook"][file] attempts to salvage valid cells from the given notebook file and writes them into a new untitled notebook window. | |
ResourceFunction["SalvageNotebook"][file,newfile] writes the salvaged cells directly to a new notebook file. | |
ResourceFunction["SalvageNotebook"][file,List] returns the salvaged cells as a list. | |
ResourceFunction["SalvageNotebook"][] displays a dialog for choosing a notebook file to salvage. |
| "IgnoreBoxDataCells" | False | whether to ignore cells containing BoxData |
| "IgnoreGraphicsDataCells" | True | whether to ignore cells containing GraphicsData |
| "SummarizeCorruptLines" | True | whether to summarize lines that are not part of a valid cell expression |
Choose a notebook file to salvage:
| In[1]:= |
| Out[1]= |
Write an intentionally-corrupt notebook to a temporary file:
| In[2]:= |

Salvage valid cells from that file and place them a new untitled notebook:
| In[3]:= |
| Out[3]= |

Return cells salvaged from a notebook as a List:
| In[4]:= | ![]() |
| Out[5]= |
Salvage a notebook file directly to a new notebook file:
| In[6]:= | ![]() |
| Out[7]= |
Write an intentionally-corrupt notebook to a temporary file:
| In[8]:= |

Turn off "SummarizeCorruptLines" to cause the data that is not recognized as valid cells to be inserted literally in the resulting salvaged data:
| In[9]:= |
| Out[9]= |

Write an intentionally-corrupt notebook to a temporary file:
| In[10]:= |

Turn on "IgnoreBoxDataCells" to automatically skip any BoxData cell:
| In[11]:= |
| Out[11]= |

This work is licensed under a Creative Commons Attribution 4.0 International License