XLSX corrupt after accidental open & save in Notepad [closed] - excel

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
Is there a programmatic, built-in, or external method to recover a corrupt Excel file?
I accidentally opened my .XLSX file (Excel 2010) in Windows Notepad, added a line of recognizable text, and saved it. Now the file cannot be opened by Excel, as the internally compressed .XLSX file cannot be uncompressed.
My research showed me that:
The .XLSX file is a compressed archive, starting with PK….
By saving the file in Notepad, all Null/\0 characters were replaced with spaces (0x20).
Before the mistake happened, the file contained already several hundreds of 0x20 characters, so replacing all 0x20 with 0x00 won't help.
Any ideas are appreciated! Thanks in advance!

Wow, that sucks, bigtime.
I've seen lots of corrupt files caused lots of different ways but that's a new one.
That series of events if probably near the top of the list of "Things not to do to Excel files." We're sorry, we'll have to suspend your "Excel Operator's License".
I guess there's a couple things you could try...,
Plan A
Is there any chance you have Autorecover turned on? If not, you should probably turn them on now, for "next time".
If it is on, then hopefully the Document Recovery task pane appears when you try to open the file (in Excel). If so, see:
Office.com : Recover your Office Files
Even if your file doesn't show up in that dialog, double-check all of the folders/files located in the default AutoRecover save location to see if a recent version was saved, "just in case":
%AppData%\Microsoft\Excel
Plan B:
Since an XLSX file is actually just a .ZIP file, there's a chance you may be able to use WinZip or a ZIP Repair Utility to recover your data (depending, of course, on how badly you messed it up.)
Change the file's extension to .ZIP and open it with WinZip.
It may try to repair the file, and if it does it might even succeed (on some or all "parts").
Put all the files back into a new .ZIP.
Change the extension back to .XLS.
Cross you fingers and try opening it with Excel.
There are also lots of standalone ZIP Repair Utilities out there, so you could try a few others with the same process.
I have no idea if any will actually work in this case, but please report back if you do end up trying any of them (whether or not they fix it), so we all know.
More about Excel File Structure:
XML & ZIP: Explore Your Excel Workbooks File Structure
Plan C:
Short of that working, you could try opening it back up in Notepad and see if there's any legible data you can copy & paste out manually... might be there a while, if there's anything at all...
Plan D:
There is no Plan C. Sorry, you're SOL.
How to turn on AutoRecover (for next time):
Click File → Options → Save
Make sure the Save AutoRecover information every x minutes box is selected
Important: Even after turning AutoRecover on, the Save button is still your best friend.
To be sure you don’t lose your latest work, click Save Button
(or press Ctrl+S) often.
Oh, and in the future:
Don't open Excel files in anything but Excel.
Source & More Info:
Office.com: Use AutoSave and AutoRecover to help protect your files in case of a crash

Related

Excel hangs/crashes while updating external link at file opening

I encountered this weird ass and funny error.
I built a file for data ETL. This one takes in various .csv files, combines them and export new .csv files using VBA. The file is originally named as "xxx Modelling ETL.xlsm". It could be opened normally till one day it hangs or crashes while trying to recalculating something (may be the underground query).
After hours of struggling, I opened the file as a copy (under a new name of Copy of ...). Strangely it ran smoothly, no crash or hang. Then I try rename it by remove the "Copy of" part, then the error occurs again.
I want to share this as there could be someone has the same problem, or someone who could shed some light on this black magic thing.
Some solutions:
Rename the file or move it to local drive instead of Onedrive makes thing works normally again.
Open Trust Center, disable Macro with notification, Trusted Locations, and Trusted Documents. Enable them for specific files when open, not for all.

Saving File without an extension [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
We have a system that creates files that are imported into Oracle. The files have the naming convention...
Filename.0000
Where the numbers are incremented with each export. So one file might be filename.4357 and the next file will be filename.4358.
I have managed to import the file into a spreadsheet as a comma delimited file where I then carry out some cleansing of the file.
I then want to save the file back to this unusual type .0000 but I can only seem to save it as Excel, CSV, TXT, PDF etc.
Does anyone have any ideas ? Thank you in advance.
Nothing yet
Save the file as a txt file and close it. Then rename it in Windows Explorer.
You can also do that with VBA. Use the NAME command to rename it to a file name with the desired extension.
https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/name-statement

Excel open same names files

I need to create a button in Excel that opens a dialog box and I select the file that I recorded on the second sheet, but I also automatically select other files with the same name differs just ending. So I need to choose one file, and always record 2-3 more with the same name and to open a new worksheet. How to do it?
What you need to select the file abc.txt and uploaded to other files abc.ydd and abc.dyk name will always be the same only the ending will be different.
An advice for any work you are doing: Break down your big task into small steps as often as needed until the steps are small enough so that you know how to process them.
On your specific programming task, this means, you should break it down into:
You need a button on one of the excel sheets.
That button has to open a dialog box for selecting a file
I don't know whether it can be any arbitrary file or a specific one, as you wrote that the file was recorded on another sheet. I think that makes no difference at all.
After finishing the file selection, you have to evaluate the result of the dialog box (OK -> which file, ABORT -> do nothing).
Take the file name, remove the extension and search for other files (in the same directory or elsewhere) with that name.
I don't know why you want to open another worksheet. Of course you can do that, but if you want to show the content of that files in the worksheet, they better be excel files.
How you do these suggested steps is something you need to find out by yourself. Or you are lucky and find someone else who has plenty of free time to do that for you, but I don't think you will be that lucky, especially after providing a quite vague description of your problem.
In general, stackoverflow is for asking for solutions to specific programming problems, not for providing ready-to-use solutions for beginners. Take a look at VBA manuals and tutorials. They can be found widely across the internet and in book stores.

Recover unsaved .csv file changes

Does anyone know a way to recover changes made in a .csv that were not saved when excel 2007 was closed.
At the moment, I don't see any way to solve this.
Check all the temporary files created recently. Especially alongside the file you opened. There are a few temp folders in the system that Excel may use. C:\Windows\temp is the main one, but it is usually under the Users folder in later versions of windows. Eg: C:\Users\YourUserName\Local Settings\Temp
If you find any files that look like Excel temps, take a copy and rename the extension and then try to open it.
(Your only real chance is if auto-save kicked in and saved a copy - to a temp file - when you still had your new changes in the document. Otherwise the changes are lost I'm afraid)
If option #1 doesn't resolve your problem in Excel, go to File->Options->Save. Hopefully your AutoRecover file location, under the third box, will be populated with an address.

Is there an easy way to View, Edit & Locally store a .txt file through Chrome [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
This isn't necessarily a coding problem, but users here would be the perfect people to ask.
Is there an easy way to view and edit a simple text file (.txt seems the most obvious) on a browser (I use Chrome). I'd like this file to be stored locally as well, preferably in my dropbox folder so it's backed-up at all times.
I tried looking for a chrome extension that does this, but after 3 failed attempts I thought there might be a manual way to do this.
I don't care about the format as long as it's common and can be opened on other computers if need be.
Paste the following into your browser address field to get a ready browser notepad:
data:text/html, <html contenteditable>
You can type or paste your text here, edit and then save as page or copy somewhere. Suggested by Jose in his blog.
HTML5 has a File API: http://www.html5rocks.com/tutorials/file/filesystem/
Once you read that you will realize that you can use a blob builder to write to a file, then post that file back to your browser which will automatically download it.
var bb = new BlobBuilder();
bb.append(message.value);
var blob = bb.getBlob();
location.href = window.webkitURL.createObjectURL(blob);
This is an old question, but I've wanted this ability for a long time and finally found a solution that works for me. In Chrome, set up a Workspace folder as described here.
I wanted to edit a markdown file, so I created an empty file called editable.md in my workspace folder. With Chrome developer tools open, in the Sources pane, I can double click this file to edit it. Even better, I have the MarkView plugin installed, so I see a nicely rendered version of the markdown in the main view.
I think there's a reason why web browsers and text editors are called the way they are. Why would you wan't a functionallity like that? There are other tools for that.
Maybe your answer is a server which handles this kind of requests - allows information to be added, and stores it in it's own dropbox folder which is shared with other users.
The main problem is that browser can't that easily access files on your computer if those aren't cookies, tmp files.

Resources