You can...
- Exit Excel
- Make a copy of your Excel file and add to the extension
(i.e.
.xls
or .xlsm
) .xml.zip
. For example, test.xls
becomes test.xls.xml.zip
.
- Unzip the
.zip
file. Yes, Excel files
are really .zip
files.
This will give you a directory named test.xls.xml
(or test.xlsm.xml
) that contains the following directory structure: \xl\worksheets
.
In the worksheets
directory are your Excel worksheets, in XML format. They are not formatted for readability, so use an editor that is capable of "pretty" formatting the XML (I use EditPlus or XMLSpy. There are many out there.). Now that you can read the XML, you can use the regular expression feature of the editor to make changes.
When you are done, go to the test.xls.xml
(or test.xlsm.xml
) directory. You will see the _rels
, docProps
and xl
subdirectories and the [Content_Types].xml
file. Select everything, right click and choose Send to > Compressed (.zip) folder
. Make sure there are no .bak
files left over by your text editor (in the worksheets
subdirectory). If they're there, delete them before creating the new .zip
file. Now rename the extension of this new .zip
file to .xls
(or .xlsm
).
You can now open this file in Excel. Excel won't mind that you've "pretty" formatted the XML.
I have done this exact procedure many times, never with any problems (unless I accidently left the .bak
files laying around).
One word of warning, Excel cells that contain just text (i.e. no formulas) store the text in a different file and reference them from within the worksheet file, so you won't see that text there. Any text contained in a formula (i.e. CONCAT("ABC", "DEF")
) is preserved in the worksheet.