openpyxl issueshttps://foss.heptapod.net/openpyxl/openpyxl/-/issues2023-11-16T12:02:06Zhttps://foss.heptapod.net/openpyxl/openpyxl/-/issues/2113Add repr for dimensions2023-11-16T12:02:06ZCharlieCAdd repr for dimensionsWould be nice to be able to see column and row dimensions directly without additional introspection.Would be nice to be able to see column and row dimensions directly without additional introspection.CharlieCCharlieChttps://foss.heptapod.net/openpyxl/openpyxl/-/issues/2041Can't do a branch in this repo and ide doesn't work2023-05-17T09:53:54Zpablo ruizCan't do a branch in this repo and ide doesn't workNot a real issue of the code, I'm new in gitlab-heptapod and mercurial and just want to make a contribution but it's being very hard for me, I don't understand why a "hook" is preventing me to branch the code:
![image](/uploads/85454e18...Not a real issue of the code, I'm new in gitlab-heptapod and mercurial and just want to make a contribution but it's being very hard for me, I don't understand why a "hook" is preventing me to branch the code:
![image](/uploads/85454e1812ae6fe4e190592f360a8554/image.png)
Also in the online editor:
![image](/uploads/7960b9b10a10d9faf16a361370182e0f/image.png)
These messages should be a bit more self explanatory, probably they come from the gitlab side, but I didn't find the way of contributing here whatsoever. I also took a look into the docs:
https://openpyxl.readthedocs.io/en/stable/development.html
But i find no information on how to make a branch or a pull request without getting these errors. I have experience using github, but still found a significant barrier for contributing here. At first I didn't even know that we need first to request access etc. In any case I think it would be helpful to expand into the contributions docs, to cover these questions in the readme, or in general make the entry barrier a bit lower. I can help to document the contribution process if you want.
I don't know where to ask better than making this issue, maybe in the mail list was a better idea? please feel free to move the issue to a more appropriate place or close it.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/2006Add `width` and `height` properties to `CellRange` objects2023-04-06T15:37:09ZCharlieCAdd `width` and `height` properties to `CellRange` objectsIt can be useful to know how wide or tall a range of cells is for calculating stuff.It can be useful to know how wide or tall a range of cells is for calculating stuff.CharlieCCharlieChttps://foss.heptapod.net/openpyxl/openpyxl/-/issues/1994Separate outlining from formatting for column (and possiby row dimensions)2023-03-16T14:19:50ZCharlieCSeparate outlining from formatting for column (and possiby row dimensions)As per #1988 the implementation of column dimensions is probably too close the OOXML which is at best vague and at worst downright misleading.
The major problem with the specification is that it conflates column specific attributes such...As per #1988 the implementation of column dimensions is probably too close the OOXML which is at best vague and at worst downright misleading.
The major problem with the specification is that it conflates column specific attributes such as width, with cell formats even though these are not applied and outlining definitions for groups of columns. This is less of a problem for rows, not least because grouping is implied solely through the outline level.
The proposal is to create a separate worksheet level object solely for grouping columns for outlining purposes. This would make the API more explicit: `ws.column_groups` would only contain ranges with the relevant outlining settings; `ws.column_dimensions` would only contain information for individual columns with groups not possible.
When reading existing worksheets groups would be checked for their attributes. Outlines would be added to column_groups, formatting would be split into individual columns.
The definition can be preserved at serialisation time because the format allows multiple definitions with precedence being given to the last definition.
It is to be decided as to whether an orthogonal property should exist for row groups because these do not implement grouping directly.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1990Create conversion utilities for Excel tables and PivotTables to Pandas Datafr...2023-03-11T16:42:03ZCharlieCCreate conversion utilities for Excel tables and PivotTables to Pandas DataframesThe XML types probably contain sufficient information and metadata to allow creation of Dataframes programmatically.
Probably easiest to start with Tables because they're much simpler.The XML types probably contain sufficient information and metadata to allow creation of Dataframes programmatically.
Probably easiest to start with Tables because they're much simpler.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1981Setting active sheet does not unset active attribute of previous one2023-02-27T10:06:32ZgsportelliSetting active sheet does not unset active attribute of previous oneWhen I set the active sheet like this:
wb.active = 3
and then save and open the workboox with Excel, sheet 3 is active as intended, but the old active sheet remains active as well.
Other users have seen this behaviour as [posted h...When I set the active sheet like this:
wb.active = 3
and then save and open the workboox with Excel, sheet 3 is active as intended, but the old active sheet remains active as well.
Other users have seen this behaviour as [posted here](https://groups.google.com/g/openpyxl-users/c/Y9_iSeTi3bM).https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1970Allow chartsheets to contain multiple charts2023-02-17T16:48:36ZCharlieCAllow chartsheets to contain multiple chartsChartsheets can contain more than one chart. This is done in Excel by creating the charts and moving them to the chart sheets. Openpyxl can neither read nor create such chartsheets.
The implementation is interesting because it uses rela...Chartsheets can contain more than one chart. This is done in Excel by creating the charts and moving them to the chart sheets. Openpyxl can neither read nor create such chartsheets.
The implementation is interesting because it uses relative sizing. But it also relies on shoehorning the visible charts into the userShapes part of an essentially empty chart. Implementation might allow a simpler API for chartsheets: limit them to one chart only but introduce the idea of a multichart. NB. this is semantically very different to combi charts which share the same plot area.
[multi.xlsx](/uploads/fc1396101b14f6a7e73dbba5beef9fad/multi.xlsx)https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1671Validate user entered formulae using the tokeniser2021-04-16T09:46:06ZCharlieCValidate user entered formulae using the tokeniserWe can probably use the tokeniser to sanity check formulae entered by users. This should pick up unknown function names and common formatting mistakes such as using ";" instead of "," to separate parameters.We can probably use the tokeniser to sanity check formulae entered by users. This should pick up unknown function names and common formatting mistakes such as using ";" instead of "," to separate parameters.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1523Openpyxl does not read/write worksheet custom properties2022-10-23T09:49:51ZAlex LeyOpenpyxl does not read/write worksheet custom propertiesThese Worksheet.CustomProperties are not to be confused with Workbook.CustomDocumentProperties.
- Worksheet.CustomProperties: https://docs.microsoft.com/en-us/office/vba/api/excel.worksheet.customproperties
- Workbook.CustomDocumentPr...These Worksheet.CustomProperties are not to be confused with Workbook.CustomDocumentProperties.
- Worksheet.CustomProperties: https://docs.microsoft.com/en-us/office/vba/api/excel.worksheet.customproperties
- Workbook.CustomDocumentProperties: https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.customdocumentproperties
They are similar, in that it allows users to save data outside of a sheet/workbook in a collection of objects, each with a name and value.
Workbook.CustomDocumentProperties are saved to the Workbook and have been implemented (pending merge) as part of issue #1003 (and Worksheet.CustomProperties were also discussed and I expressed that I would like to add this feature too)
Worksheet.CustomProperties are slightly more complicated, as there are not only .XML files involved.
Each CustomerProperty is stored as a .bin file, which get's referenced in the "xl/worksheets/sheet{n}.xml" and the "xl/worksheets/_rels/sheet{n}.xml.rels" and the manifest "[Content_Types].xml"Alex LeyAlex Leyhttps://foss.heptapod.net/openpyxl/openpyxl/-/issues/1480How to remove the chart title of any chart in excel2020-06-26T11:57:52ZBitbucket ImporterHow to remove the chart title of any chart in excel*Created originally on Bitbucket by [Rupesh Yadav](https://bitbucket.org/%7B593d16cd-bf73-4981-b419-d19a8e034b6d%7D/)*
Currently, I’m trying to create a pie chart in excel but by default it writes a title for the chart, I don’t want any...*Created originally on Bitbucket by [Rupesh Yadav](https://bitbucket.org/%7B593d16cd-bf73-4981-b419-d19a8e034b6d%7D/)*
Currently, I’m trying to create a pie chart in excel but by default it writes a title for the chart, I don’t want any title, I tried to use this
**Chart.title = ''** when I used this it created an empty string but chart title textbox was still there.
And this **chart.title=None**
But nothing worked.
In the desktop application, if we click on the chart it shows a plus button at the side of the chart and when we click it it shows the chart elements such as chart title, data labels, legend and if we untick the chart title, title of the chart will be removed, I want to do this with openpyxl. Can anyone help me with this?
For example I have the chart attached with the problem, I want to remove **Rate\(%\)** from the chart.
*Attachments:* [ezG2P](/uploads/a812694c67ba0c19087d5852ca4d84ee/ezG2P.png)https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1475Alternate theme support for full document2020-06-26T11:57:43ZBitbucket ImporterAlternate theme support for full document*Created originally on Bitbucket by [Erin Piazza](https://bitbucket.org/%7B1f575c44-64d6-48a9-ac9e-ca13020cdd48%7D/)*
I use openpyxl in many scripts to create pre-formatted excel spreadsheets that contain tables. Tablestyleinfo allows y...*Created originally on Bitbucket by [Erin Piazza](https://bitbucket.org/%7B1f575c44-64d6-48a9-ac9e-ca13020cdd48%7D/)*
I use openpyxl in many scripts to create pre-formatted excel spreadsheets that contain tables. Tablestyleinfo allows you to use the name of the style, but the actual appearance of that style depends on the color theme for the document. As far as I can tell, the theme for the document is written as an exact string to a theme.xml document. The theme style used is the old Office style \(Office 2007-2010\), so at a minimum updating to the current default may be useful.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1433Allow user to specify a Worksheet factory2020-06-26T11:56:20ZBitbucket ImporterAllow user to specify a Worksheet factory*Created originally on Bitbucket by [simsong (Simson Garfinkel)](https://bitbucket.org/%7B27d66b94-9121-435c-b888-10de07a5d21b%7D/)*
Currently it is hard-coded [here](https://bitbucket.org/openpyxl/openpyxl/src/8953233f5af287d9cdf3dae34...*Created originally on Bitbucket by [simsong (Simson Garfinkel)](https://bitbucket.org/%7B27d66b94-9121-435c-b888-10de07a5d21b%7D/)*
Currently it is hard-coded [here](https://bitbucket.org/openpyxl/openpyxl/src/8953233f5af287d9cdf3dae34e437e76bea5bd59/openpyxl/workbook/workbook.py#lines-182) that Workbook creates new Worksheets by calling the Worksheet\(\) constructor directly. It would be useful if the constructor was a property so that the user could change it. This would allow the user to have their own Worksheet subclass and for it to be natively used.
I would like this functionality, so I plan to implement this and send it as a pull request. This issue is a placeholder for that.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1412Add ability to enable change tracking2020-06-26T11:55:46ZBitbucket ImporterAdd ability to enable change tracking*Created originally on Bitbucket by [Jacob Floyd](https://bitbucket.org/%7Bcd26d565-2895-420c-8979-c29f7159b8b0%7D/)*
I would like to enable change tracking \(revisions\) in a generated spreadsheet. I do not need to record or work with ...*Created originally on Bitbucket by [Jacob Floyd](https://bitbucket.org/%7Bcd26d565-2895-420c-8979-c29f7159b8b0%7D/)*
I would like to enable change tracking \(revisions\) in a generated spreadsheet. I do not need to record or work with those changes, I just need to initialize the revisions section of a workbook.
Looking in a blank spreadsheet with this enabled I see:
xl/revisions/\_rels/revisionHeaders.xml.rels
xl/revisions/revisionHeaders.xml
xl/revisions/revisionLog1.xml
xl/revisions/userNames.xml
The only files with any content that would need to be adjusted for the workbook \(the others only need the default content\):
xl/revisions/revisionHeaders.xml
* guid attribute on headers element and on child header element
* dateTime and userName attr on child header element.
* sheet counts: maxSheetId on header; count on sheetIdMap element \(child of header\); and sheetId elements \(children of sheetIdMap\).
xl/\_rels/workbook.xml.rels
* Needs references to revisions/userNames.xml and revisions/revisionHeaders.xml
https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1410unescape chars like "_x0020_"2023-10-24T19:29:09ZBitbucket Importerunescape chars like "_x0020_"*Created originally on Bitbucket by [arnaugil126 (Arnau Gil)](https://bitbucket.org/%7B5241fb73-09e5-433f-96fb-2a03d10ec171%7D/)*
I have some xlsx files which contain chars like `_x0020_`, which is the escaped value for `" "` \(empty st...*Created originally on Bitbucket by [arnaugil126 (Arnau Gil)](https://bitbucket.org/%7B5241fb73-09e5-433f-96fb-2a03d10ec171%7D/)*
I have some xlsx files which contain chars like `_x0020_`, which is the escaped value for `" "` \(empty string\) in SharePoint.
xlrd unescape these values to get the original chars using this function [https://github.com/python-excel/xlrd/blob/bbccdcb96e40b590d71ed14682237bea1e8f1dc5/xlrd/xlsx.py#L136](https://github.com/python-excel/xlrd/blob/bbccdcb96e40b590d71ed14682237bea1e8f1dc5/xlrd/xlsx.py#L136)
Could we do the same in openpyxl?
https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1397DataBar axis position when negative values exist2020-06-26T11:55:22ZBitbucket ImporterDataBar axis position when negative values exist*Created originally on Bitbucket by [Justin Lute](https://bitbucket.org/%7B328d02dc-d99e-4901-bb29-b41ac9aaafc9%7D/)*
**USER STORIES**
* As a creator of custom Excel reports using openpyxl, I want to display DataBars where negative v...*Created originally on Bitbucket by [Justin Lute](https://bitbucket.org/%7B328d02dc-d99e-4901-bb29-b41ac9aaafc9%7D/)*
**USER STORIES**
* As a creator of custom Excel reports using openpyxl, I want to display DataBars where negative values are represented by a magnitude \(i.e., bar length\) that increases towards the left of the cell from a central axis, so that negative values are more readily distinguishable from positive values.
* As a creator of custom Excel reports using openpyxl, I want to generate DataBars where negative values have a bar of a different color than positive values, so that negative values are more readily distinguishable from positive values.
**DETAILS**
An extremely valuable feature of conditional formatting in Excel using DataBars is the ability to set the _axis_ position to the center of the cell when there are negative values present in the selection. Moreover, one can even set a different color for negative values. Thus, for example, one could have positive values displayed with a green bar that increases towards the right; with negative values displayed with a red bar that increases towards the left.
For example…
![](https://bitbucket.org/repo/RMdExx/images/3618147029-image.png)
It would appear that there is an API for the axis position \([https://docs.microsoft.com/en-us/office/vba/api/excel.databar.axisposition](https://docs.microsoft.com/en-us/office/vba/api/excel.databar.axisposition)\) and for a negative bar format \([https://docs.microsoft.com/en-us/office/vba/api/excel.databar.negativebarformat](https://docs.microsoft.com/en-us/office/vba/api/excel.databar.negativebarformat)\).
How feasible would it be to implement this in openpyxl? Aside from _openpyxl.formatting.rule.DataBarRule_, where else would changes need to be made?
I am unlikely to be skilled enough to implement this feature myself at this time. Otherwise, I would have implemented already and issued a PR.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1388_HeaderFooterPart not support link to picture with legacyDrawingHF Attributes2020-06-26T11:54:28ZBitbucket Importer_HeaderFooterPart not support link to picture with legacyDrawingHF Attributes*Created originally on Bitbucket by [TWINKLE](https://bitbucket.org/%7B28cea687-7efb-43b5-b8b0-c6ac9b9b896f%7D/)*
\_HeaderFooterPart not support link to picture with legacyDrawingHF Attributes
`ws.oddHeader.left = _HeaderFooterPart(...*Created originally on Bitbucket by [TWINKLE](https://bitbucket.org/%7B28cea687-7efb-43b5-b8b0-c6ac9b9b896f%7D/)*
\_HeaderFooterPart not support link to picture with legacyDrawingHF Attributes
`ws.oddHeader.left = _HeaderFooterPart("&[Picture]")`
```
<headerFooter>
<oddHeader>&L&G&C&T</oddHeader>
<oddFooter></oddFooter>
<evenHeader></evenHeader>
<evenFooter></evenFooter>
<firstHeader></firstHeader>
<firstFooter></firstFooter>
</headerFooter>
```
the right attributes is
# **<legacyDrawingHF r:id="rId3"/>**
```
<headerFooter>
<oddHeader>&L&G&C&T</oddHeader>
</headerFooter>
<legacyDrawingHF r:id="rId3"/>
```
thx.
>
https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1383DrawingML support for Shapes and drawings ?2020-06-26T11:54:13ZBitbucket ImporterDrawingML support for Shapes and drawings ?*Created originally on Bitbucket by [Darak Dir](https://bitbucket.org/%7B67436f4c-1309-41dd-a7e1-7b788aa6365b%7D/)*
My heartfelt gratitude & thanks for openpyxl. Hats Off ! I was able to accomplish and deliver requirements that are not ...*Created originally on Bitbucket by [Darak Dir](https://bitbucket.org/%7B67436f4c-1309-41dd-a7e1-7b788aa6365b%7D/)*
My heartfelt gratitude & thanks for openpyxl. Hats Off ! I was able to accomplish and deliver requirements that are not easily supported \(to my little knowledge\) by Java, .NET & PowerBI. Any possible/tentative dates for shapes & drawing \(if feasible\) ?
https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1320support custom data classes in cell value writing2020-06-26T11:52:15ZBitbucket Importersupport custom data classes in cell value writing*Created originally on Bitbucket by [Lars Yunker](https://bitbucket.org/%7Bd12b9e28-de68-4182-b1ad-4cac539659a4%7D/)*
From what I gather, openpyxl only supports python builtin classes when writing to `cell.value`. While this covers the ...*Created originally on Bitbucket by [Lars Yunker](https://bitbucket.org/%7Bd12b9e28-de68-4182-b1ad-4cac539659a4%7D/)*
From what I gather, openpyxl only supports python builtin classes when writing to `cell.value`. While this covers the vast majority of users' needs, it blocks users from writing custom data classes. As an example, I'm trying to provide excel support for a custom class \(a value with a unit\). This can be represented in an excel spreadsheet by setting the cell value to the numerical value and applying a custom format. Instead, I'm greeted with a `ValueError`\(line 238 of `cell._bind_value`\).
I suggest that in the `elif value is not None` block there be an attribute check of the provided value for a `_openpyxl_format` method \(or similarly named\) which will expect a `value` and `number_format` return. If the return fails to produce the expected values then the usual error could be raised. By doing this, you would enable developers to add openpyxl support to their custom classes.
Proposed change to `cell._bind_value`:
```python
elif value is not None:
if hasattr(value, '_openpyxl_format'): # if coded with openpyxl support
# retrieve value and number format
value, number_format = value._openpyxl_format()
# if a number format was specified, apply
if number_format is not None:
self.number_format = number_format
else:
raise ValueError("Cannot convert {0!r} to Excel".format(value))
```
A developer could then add a method like this to their class
```python
def _openpyxl_format(self) -> Tuple[float, str]:
"""adds openpyxl custom formatting support, returning the value and custom number format"""
return self.value, self.custom_format
```
For example "10.123 mL" would give the return `(10.123, '0.0" mL"')`. This correctly sets the value in the cell and applies a valid custom format to the number in Excel. Applying this change appears to work in my brief testing and should not affect other users \(unless the method is specifically coded, nothing different will happen\). The developer will have to ensure that the custom format is valid, but I see that as a reasonable caveat. Improper specification of this format results in an workbook recovery prompt, but this is identical to the user manually specifying an invalid number format.
I appreciate that I could accomplish the same thing with this code:
```python
cell.value = float(passed_value)
cell.number_format = '0.0" mL"'
```
but I feel that it is unnecessary to expect users who want to use a custom class and openpyxl together to manually code value writing where the addition of a class method will define the writing behaviour of all instances of that class.
I’m happy to break this out into a branch and create a merge request, but I wanted to open it for discussion before doing that.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1300Styles are not transfered when inserting a row2024-02-23T22:51:05ZBitbucket ImporterStyles are not transfered when inserting a row*Created originally on Bitbucket by [Vincent PFARR (Vincent Pfarr)](https://bitbucket.org/%7B12e6c61e-538f-4282-a934-099b4875e0b7%7D/)*
Using a template with styles \(row height modified, cell colors, cell merged, etc.\) i would like to...*Created originally on Bitbucket by [Vincent PFARR (Vincent Pfarr)](https://bitbucket.org/%7B12e6c61e-538f-4282-a934-099b4875e0b7%7D/)*
Using a template with styles \(row height modified, cell colors, cell merged, etc.\) i would like to insert a row somewhere here.
When inserting a row, text after this row is moving one row after what is correct, but the style stays at the same row.https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1202Accessing/Modifying Existing Charts2020-06-26T11:48:05ZBitbucket ImporterAccessing/Modifying Existing Charts*Created originally on Bitbucket by [thephatp (Chad Morris)](https://bitbucket.org/%7Ba1ebd120-0170-40bd-93c1-beb2ef76e57a%7D/)*
Is there any way to access an existing chart, rather than having to create a new chart each time?
My use...*Created originally on Bitbucket by [thephatp (Chad Morris)](https://bitbucket.org/%7Ba1ebd120-0170-40bd-93c1-beb2ef76e57a%7D/)*
Is there any way to access an existing chart, rather than having to create a new chart each time?
My use case is this: I'm pulling data from an external source and putting into excel. I have an existing chart that visualizes the data. I want to grab the chart as it exists already and save the chart as an image.
My problem: I don't see a way via the documentation for openpyxl to get an existing Chart object--only creating new.