BadZipFile("File is not a zip file") on files with Sensitivity Label set - openpyxl

I'm getting BadZipFile("File is not a zip file") on files with Sensitivity Label set.
Is there a way to use openpyxl with excel will for which Sensitivity Label is set?
Or maybe there is a way to remove the Sensitivity Label wither programmatically or on all files in a folder?

This little tool fixed my problem https://learn.microsoft.com/en-us/azure/information-protection/rms-client/install-unifiedlabelingclient-app

Related

Does openpyxl preserve cell color?

I'm creating an Excel file from the template. So I expect the formatting of the template to be preserved. However it seems saving of the workbook to new file looses some of formatting (at least cell color).
Original file looks like that:
I do then following:
import openpyxl
wb = openpyxl.open('c:\\temp\\test_templ.xlsx')
wb.save('c:\\temp\\test.xlsx')
Resulting file is 9KB smaller than original and looks like this:
Is there any way to save the Excel file with keeping the formatting?
Yes, it does. The problem I have met was abnormally complex Excel file with thousands of styles. So it seems some of them weren't properly read by openpyxl and hence the problem I had. But if you start with the clean slate and add necessary formatting openpyxl does the job just fine.

Change name of power point files

I would like to change name of Powerpoint files.
I have my ppt file name like : 1.pptx, 2.pptx inside a folder.
I would like to change this name with a corporate title.
How can I proceed to change the name of Powerpoint files in VBA ?
Thanks a lot.
Renaming a file in vba is done with the Name statement
Name "old.pptx" As "new.pptx"
Note that this would fail if you are trying to rename an open document or if your code doesn't have the right permissions

Preserve settings in the file

I am creating my excel add-in that saves the current file as csv into user-specified folder. I would like my program to ask for the folder path the first time the program is launched and to remember that folder in the future. I am wondering is there any way to preserve the data within the program? I figured that I could write the path into .txt-file but that feels a little hack-like solution and would clutter the addin folder.
I use the GetSetting and SaveSetting functions in my VB 6 apps. Rather than cover them in detail, take a look at this excellent web page that illustrates how to use in with Excel
Excel Tips From John Walkenbach
Create a Worksheet, and store the values in cells. Then in the VBA Editor find the Worksheet in the Project Explorer (Ctrl + R) and set "Visible" to "2 - xlSheetVeryHidden" in the Properties Pane (F4) so that it is not readily visible to users.
You can then set/retrieve the data in with code in the format SheetName.Cells(row,column).Value, e.g.
MyPath = Sheet1.Cells(1,2).Value 'Get data from cell B1
Sheet1.Cells(2,2).Value = NewPath 'Set data in cell B2
There are multiple ways to approach this. Besides the hidden sheet approach, already described, you can
Write the information to a CustomXMLPart. This is a xml file stored in the workbook's ZIP file where information can be stored.
For something as short and simple as a file path, you could also use a CustomDocumentProperty

How to save RichTextBox text to a text resource file?

I have created a text file named 'Notes' in the resources of my project and want to load/save the text of a RichTextBox to it. I tried using MyProject.My.Resources.Notes in the path. It doesn't show any error in the code window but when I run it, it shows an error.
Here's what I'm using to load the text:
RichTextBox1.Text = System.IO.File.ReadAllText(MyProject.My.Resources.Notes)
Here's what I'm using for saving it:
System.IO.File.WriteAllText(MyProject.My.Resources.Notes, RichTextBox1.Text)
This is not a duplicate. I did not get an answer from the other question
Why don't you use a regular file which always works fine or a database?
Edit: maybe this helps?
www.dondraper.com/2011/01/easily-save-and-retrieve-application-and-user-settings-in-vb-net-or-c-apps/

SQL developer Import data wizard comes up blank

So I have a file that has over 100 entries in it as an excel worksheet. I want to put those over into a sql. So I fire up my sql developer and try and import the data but it doesn't show up.
The next and finish buttons don't do anything. (the blue underline words aren't links to anything either fyi)
Have you tried converting the original file to text (csv) then importing? That has worked for me in the past.
I had the same problem and the only way to get rid of it was to rename the preferences folder (as described here: https://www.thatjeffsmith.com/archive/2015/08/how-to-reset-your-sql-developer-preferencessettings/) and start the program with factory defaults.
One more reason is that the CSV or excel file is of 0 kb size or empty.