#1
|
|||
|
|||
How to recreate excel .xlsx file from unzipped xml folder
I'm trying to convert a folder of xml that was created by unzipping an excel file back into an excel .xlsx. But I get the error
>The workbook cannot be opened or repaired by Microsoft Excel because it is corrupt The actual file I want to recreate is a fairly large macro-enbled .xlsm spreadsheet created with Excel 2016. I am using the xml format to archive in a git repository in order to provide version control. However, restoring a version from the archive requires that I can reverse the process. However, a minimal example with a simple spreadsheet also reproduces this issue. **A minimal reproducible example to generate this error:** 1. Create a new blank spreadsheet in Excel 2. Enter "test" in cell A1 3. Save as `test.xlsx` 4. Rename file to `test.zip` 5. Unzip `test.zip` as a folder named `test` 6. Compress `test` into `test_new.zip` 7. Rename `test_new.zip` as `test_new.xlsx` 8. Open `test_new.xlsx` with Excel I am using Excel 2016. For zipping/unzipping I've tried 7zip, WinZip and Peazip, all with the same result. What am I doing wrong, and how can I turn unzipped excel workbooks back into their original form? Last edited by dww; 10-19-2016 at 04:17 PM. |
#2
|
||||
|
||||
The process you described works fine for me using WinZip with its default settings. I have no experience with 7-zip.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Updated question to note that I've tried with a few different zip tools -all with the same result
|
#4
|
|||
|
|||
@Macropod Thanks for trying - I've attempted this now with WinZip, 7zip and PeaZip - all with the same result. What version of Excel are you using? Could it be related to the excel version perhaps?
|
#5
|
||||
|
||||
As my profile indicates, I'm using Office 2010. That isn't the issue, however, as both is and Office 2016 use the same file format. Apparently, you're not recreating a zip file with exactly the same contents and structure as the original.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Ok I finally managed to solve this myself. The key is that when recreating the zip file, you must zip the contents of the unzipped folder. Not the folder itself!
|
Tags |
xml zip |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to create microsoft Excel 2007 and 2010 File in .xlsx format | ipacesetters | Excel | 1 | 12-16-2019 05:13 PM |
Excel does not work if any other excel file selected in any folder | tonytonytony | Excel | 3 | 03-10-2016 04:18 PM |
Excel connot open file (filename) xlsx | dengeorge6 | Excel | 0 | 12-12-2014 01:36 AM |
XLSX file won't open when clicked | MikeyChris | Excel | 9 | 09-20-2013 07:55 AM |
excel cannot open the file .xlsx because the file format or file extension is not val | teddysika | Excel | 1 | 11-22-2012 06:06 AM |