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
Related
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 5 months ago.
Improve this question
a photo of using open() and pd.read_csv() to open a link but open() says no file directory, why do I have an error when I used open() but pd.read_csv opened the file, I tried using it again but it says file not found?
The function open() opens a file which resides in persistent memory (SSD/HDD), and returns a file object.
pandas.read_csv() can parse input directly from URLs.
In other words: Because the file, as the error says, does not exist and neither does a path to said file.
Edit: I just realized that you may be new here, so maybe I'll give an analogy: Imagine I told you to open a book, and said out loud a link to a book. You would wonder how you would ever open that book as well, because you have no way of parsing that information in your head. If I instead send you link, which you open on your computer, you can read the file. open() wants a physical book. pd.read_csv() can also accept a link to the book.
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 2 years ago.
Improve this question
How can I invert this problem, I didn't touch the code but I don't know maybe while saving the file. I can't open any files anymore because it keeps opening the same macro.
Thank you for your help
The macro is likely stored in your personal workbook. Personal workbooks open every time you open excel which would explain why it looks like this macro is "haunting you from the dead".
You can read about personal workbooks here.
https://support.office.com/en-us/article/copy-your-macros-to-a-personal-macro-workbook-aa439b90-f836-4381-97f0-6e4c3f5ee566
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
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 5 years ago.
Improve this question
My file has been saved at a particular path with a name Ankit1.xls. It has macro coding and is working fine. But my question is that whenever I change the file name the macro doesn't work. I need to change the path in coding wherever needed. Please can someone help me in coding in such a way that whenever I change the file name the macro will automatically change the path and does not give me the error.
Thanks
Ankit
I guess you are looking for
ThisWorkbook.Name
or
ThisWorkbook.Path
Use Thisworkbook object in order to access data from Ankit1.xls file without changing the hardcoded constant that represents the workbook name.
Additionally you can code prior to this to check that the correct workbook has been opened.
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 7 years ago.
Improve this question
I have a set of custom formats that I would like to use in any new Excel files that I create.
I found this approach, Save cell styles to use in all new workbooks, but it relies on using a template which I cant use as I am using a cloud server so I don't have access to the XLSTART folder.
Using code is fine if I must, but I don't have experience in this space.
I understand that I may be able to create an Excel addin to hold the formats, and create a new workbook from that. Is this addin the way to go?
Please help!
Is this a desktop Excel program? If so, you might try adding another custom startup folder. (Depending on version it might be different, in 2013: Excel Options - Advanced - General - At startup, open all files in:.) Now if you put a file here, it will auto-open on Excel startup, just like the files in the XLSTART folder.
(But to be honest, I don't see how this will help you, since XLSTART - or any automatic startup folder - is useful if you want macros available. I'm not sure about templates.)