python xlsxwriter: conditional_format icon set and no cell icon - xlsxwriter

I have the requirement of using excel like conditional_format icon set in xlsxwriter. It is working same like excel but I couldn't find an option to set "No cell icon".
Is there any option available in xlsxwriter?
Below is the screenshot for reference:
Screenshot

Is there any option available in xlsxwriter.
No. That functionality was added in a later version of the Xlsx format so it isn't supported by XlsxWriter.

Related

Excel crashes after append

I am using openpyxl to automatically append data. My excel file has picture widgets(Text box) like shown below (highlighted). But the picture widgets are deleted after append. Also, I get the error: "Removed Feature: Named range from /xl/workbook.xml part (Workbook)", "Removed Part: /xl/drawings/drawing3.xml part. (Drawing shape)". Can anyone please let me know how to resolve this.
Thanks in advance!
Openpyxl can't read images directly (documentation: https://openpyxl.readthedocs.io/en/default/usage.html). There are some types of image it won't save at all.
Warning:
openpyxl does currently not read all possible items in an Excel file so images and charts will be lost from existing files if they are opened and saved with the same name.
However, there are some nice solutions on this old post, even though openpyxl functionality has changed since then. Particularly, installing Pillow via pip may help you: Images dissapear in excel documents when copying them with python
The alternative is to use libraries other than openpyxl. I have previously had cause to use openpyxl for some functions, and then stitch final image-containing documents together with win32com on Windows, for example.

Keep Font Results as Image?

I have an excel file that uses a unique font type to convert a raw value such as {ABCDEF|123456} to a bar code image.
I need to send the file to a machine that does not have adequate permissions to install this custom font.
Is there a way to keep this font type as an image within Excel? Or to keep the font output without the font installed on the current machine?
While I have found that using Copy as Picture => Appearance: "As Shown on Screen" works manually, I can't seem to get the VBA code to work well with this as I have to do this thousands of time in a single file.
All you need is to copy and paste a bitmap over a cell, not a vector:
Range("F1").Select
Selection.CopyPicture Format:=xlBitmap
ActiveSheet.PasteSpecial Format:="Bitmap"

Enabling right click copy for ipython plots?

Is there a way to enable matplotlib/ipython so I can right click my plots (in Chrome) and copy then paste elsewhere such as MS Word etc?
I know I can code and save to image etc, but often when I am playing around investigating data it would be very useful to just copy / paste into a document for safekeeping and reports.
EDIT: Problem seems to be using MS Word (2010) and any dynamic image from any Browser (IE/Chrome), If I use other progs like Write it works okay. I found some advice to change the "Pasting from other programs" option in Word settings but it has no effect.
Also another article says the problem is based on the contents of the "HTML Format" format stored in the clipboard.
Guess I need to post this question elsewhere seems to be an MS Word issue!
If you control-shift right click, it'll return to the standard Chrome context menu instead of the iPython one.
EDIT: the below answer doesn't always work anymore (something changed I think), but there is another stack overflow question here with an answer that is working, namely using Ctrl+Alt+V to do a paste-special:
Jupyter Notebook: How to copy paste image into MS word?
A straight Ctrl+V will generally fail in MS Office for this purpose, but there is the "paste image" option which is what is working for me.
If you're using ipython notebook (which I guess you must be, since you're mentioning using Chrome), you can just right-click on your graph and choose Copy Image then paste into whatever software
Drag and drop worked for me using Chrome and MS Word on macOS.

PowerPoint 2013 "PasteSpecial" won't embed Excel chart as OLE Object

I've written a macro in PowerPoint that, as part of its process, will convert a linked chart in a PowerPoint presentation to an embedded chart by copying the source Excel chart and pasting that copied chart in as an OLE object -- the specific command is, "sldComponent.Shapes.PasteSpecial(ppPasteOLEObject)".
Until today, this has worked fine in all versions from 2003 to 2010. However, when trying to run this function in 2013/365, I keep getting a run-time error stating "The specified data type is not available" (-2147188160 / 80048240). I also notice that in the Microsoft Developers Reference webpage, "ppPasteOLEObject" is no longer listed as an acceptable datatype for the PasteSpecial method (when used with the Shapes collection).
I have found several ways to programmatically paste the chart as a picture, but whenever I click on the pasted chart and try to access the data, I keep getting the message "The linked file is not available." I want the data to be entirely self-contained so the PowerPoint user can edit it without reference to the original Excel file. Interestingly, when I stop the PowerPoint macro at the buggy line and then manually click "Paste" on the ribbon, the copied chart does paste, fully embedded with data accessible, into the active slide -- so the chart is getting copied into the Clipboard; the PowerPoint macro is simply unable to read and paste it for some reason. Even more interestingly (read: frustratingly), the PasteSpecial(ppPasteOLEObject) command will work for tables copied from Excel, i.e. cell ranges, but not for charts.
What happened? How does one use VBA code in PowerPoint 2013 to embed (i.e. insert a previously-created, self-contained Excel chart including all data right in the presentation slide) an Excel chart in the new version?
ADD: I should also note that the command used to get the chart from the source worksheet in Excel is "xlCopySheet.ChartObjects(1).Select", then "appExcel.Selection.Copy". Is the problem that the chosen Copy syntax is not capturing the entire chart including data but only the display? What is the correct Copy syntax to use here?
ADD 2: Further specification: The original macro was saved and was running with both Excel and PowerPoint in Compatibility (97-2003) mode, although the apps themselves are the 2013/Office 365 versions.
If you paste the chart as a "Microsoft Office Graphic Object", the chart is pasted as an Excel chart. You can format it within PowerPoint using the Excel ribbon's Chart Tools tab, which appear in PowerPoint. If you click any of the edit/select data buttons, it opens the data in Excel.
If you paste the chart as a Microsoft Excel Chart Object, it is pasted as an embedded workbook (the entire workbook, not just the chart and its data), with a new chart sheet inserted in the embedded workbook, and this chart sheet is what is visible. You need to double click to format or edit the chart, which opens the embedded workbook in Excel, and may mess up the size of the embedded object (so it's chart-sheet sized, not chart-embedded-in-the-worksheet sized) and things like font size.
If I copy the chart in Excel and use this in the PowerPoint VB Immediate Window
activepresentation.Slides(3).Shapes.PasteSpecial ppPasteOLEObject
I get the second behavior.
You might want to try copying the chart using this:
xlCopySheet.ChartObjects(1).Chart.Copy

Can't import hyperlink to Open Refine

I imported an .xlsx file where one of the columns is filled with hyperlinks, but the links don't show on OpenRefine, just the value.
Does it happens only on Linux or it's the same thing with Windows?
If not, is there any other way to import those hyperlinks?
OpenRefine will not load the link from an XLS or XLS or ODS file in general.
You need to extract those link first into a new column in Excel. A quick search pointed to this tutorial: Excel: convert a column with hyperlinks to just display the links