Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
openpyxl
openpyxl
Commits
fffe60d2925d
Commit
17744e53
authored
Dec 14, 2018
by
CharlieC
Browse files
Empty cells should contain None but findtext() returns an empty string. :-/
--HG-- branch : 2.6
parent
30dfb45759ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
openpyxl/worksheet/_reader.py
View file @
fffe60d2
...
...
@@ -177,7 +177,7 @@ class WorkSheetParser(object):
if
data_type
==
"inlineStr"
:
value
=
None
else
:
value
=
element
.
findtext
(
VALUE_TAG
)
value
=
element
.
findtext
(
VALUE_TAG
,
None
)
or
None
if
coordinate
:
row
,
column
=
coordinate_to_tuple
(
coordinate
)
...
...
openpyxl/worksheet/tests/test_reader.py
View file @
fffe60d2
...
...
@@ -257,6 +257,20 @@ class TestWorksheetParser:
'style_id'
:
0
,
'value'
:
1
}
def
test_empty_cell
(
self
,
WorkSheetParser
):
parser
=
WorkSheetParser
src
=
"""
<c r="A1" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<v />
</c>
"""
element
=
fromstring
(
src
)
cell
=
parser
.
parse_cell
(
element
)
assert
cell
==
{
'column'
:
1
,
'data_type'
:
'n'
,
'row'
:
1
,
'style_id'
:
0
,
'value'
:
None
}
def
test_datetime
(
self
,
WorkSheetParser
):
parser
=
WorkSheetParser
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment