OpenPyXL 3.0.7
  • 教程
  • 简单用法
  • 性能
  • 优化模式
  • 插入和删除行和列,移动单元格范围
  • 操纵 Pandas 和 NumPy
  • 图表
  • 注释
  • 操控样式
  • 额外工作表特性
  • 条件格式化
  • 数据透视表
  • 打印设置
  • 使用过滤器和排序
  • 验证单元格
  • 定义名称
  • 工作表表格
  • 剖析公式
  • 日期和时间
  • 保护
  • 开发
  • openpyxl 包
  • 3.0.7 (2021-03-09)
  • 3.0.6 (2021-01-14)
  • 3.0.5 (2020-08-21)
  • 3.0.4 (2020-06-24)
  • 3.0.3 (2020-01-20)
  • 3.0.2 (2019-11-25)
  • 3.0.1 (2019-11-14)
  • 3.0.0 (2019-09-25)
  • 2.6.4 (2019-09-25)
  • 2.6.3 (2019-08-19)
  • 2.6.2 (2019-03-29)
  • 2.6.1 (2019-03-04)
  • 2.6.0 (2019-02-06)
  • 2.6.-b1 (2019-01-08)
  • 2.6-a1 (2018-11-21)
  • 2.5.14 (2019-01-23)
  • 2.5.13 (brown bag)
  • 2.5.12 (2018-11-29)
  • 2.5.11 (2018-11-21)
  • 2.5.10 (2018-11-13)
  • 2.5.9 (2018-10-19)
  • 2.5.8 (2018-09-25)
  • 2.5.7 (2018-09-13)
  • 2.5.6 (2018-08-30)
  • 2.5.5 (2018-08-04)
  • 2.5.4 (2018-06-07)
  • 2.5.3 (2018-04-18)
  • 2.5.2 (2018-04-06)
  • 2.5.1 (2018-03-12)
  • 2.5.0 (2018-01-24)
  • 2.5.0-b2 (2018-01-19)
  • 2.5.0-b1 (2017-10-19)
  • 2.5.0-a3 (2017-08-14)
  • 2.5.0-a2 (2017-06-25)
  • 2.5.0-a1 (2017-05-30)
  • 2.4.11 (2018-01-24)
  • 2.4.10 (2018-01-19)
  • 2.4.9 (2017-10-19)
  • 2.4.8 (2017-05-30)
  • 2.4.7 (2017-04-24)
  • 2.4.6 (2017-04-14)
  • 2.4.5 (2017-03-07)
  • 2.4.4 (2017-02-23)
  • 2.4.3 (未发行)
  • 2.4.2 (2017-01-31)
  • 2.4.1 (2016-11-23)
  • 2.4.0 (2016-09-15)
  • 2.4.0-b1 (2016-06-08)
  • 2.4.0-a1 (2016-04-11)
  • 2.3.5 (2016-04-11)
  • 2.3.4 (2016-03-16)
  • 2.3.3 (2016-01-18)
  • 2.3.2 (2015-12-07)
  • 2.3.1 (2015-11-20)
  • 2.3.0 (2015-10-20)
  • 2.3.0-b2 (2015-09-04)
  • 2.3.0-b1 (2015-06-29)
  • 2.2.6 (未发行)
  • 2.2.5 (2015-06-29)
  • 2.2.4 (2015-06-17)
  • 2.2.3 (2015-05-26)
  • 2.2.2 (2015-04-28)
  • 2.2.1 (2015-03-31)
  • 2.2.0 (2015-03-11)
  • 2.2.0-b1 (2015-02-18)
  • 2.1.5 (2015-02-18)
  • 2.1.4 (2014-12-16)
  • 2.1.3 (2014-12-09)
  • 2.1.2 (2014-10-23)
  • 2.1.1 (2014-10-08)
  • 2.1.0 (2014-09-21)
  • 2.0.5 (2014-08-08)
  • 2.0.4 (2014-06-25)
  • 2.0.3 (2014-05-22)
  • 2.0.2 (2014-05-13)
  • 2.0.1 (2014-05-13) brown bag
  • 2.0.0 (2014-05-13) brown bag
  • 1.8.6 (2014-05-05)
  • 1.8.5 (2014-03-25)
  • 1.8.4 (2014-02-25)
  • 1.8.3 (2014-02-09)
  • 1.8.2 (2014-01-17)
  • 1.8.1 (2014-01-14)
  • 1.8.0 (2014-01-08)
  • 1.7.0 (2013-10-31)
  • openpyxl.drawing.text 模块

    class openpyxl.drawing.text. AutonumberBullet ( type=None , startAt=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    startAt

    Values must be of type <class ‘int’>

    type

    Value must be one of {‘thaiAlphaPeriod’, ‘arabicPeriod’, ‘ea1ChsPeriod’, ‘ea1JpnChsDbPeriod’, ‘ea1ChtPeriod’, ‘romanUcParenBoth’, ‘hebrew2Minus’, ‘romanLcParenR’, ‘thaiNumPeriod’, ‘alphaUcParenR’, ‘romanLcPeriod’, ‘arabic1Minus’, ‘alphaLcParenR’, ‘circleNumWdBlackPlain’, ‘thaiAlphaParenBoth’, ‘thaiAlphaParenR’, ‘arabicDbPlain’, ‘alphaLcPeriod’, ‘ea1ChsPlain’, ‘ea1ChtPlain’, ‘arabic2Minus’, ‘romanUcPeriod’, ‘alphaUcParenBoth’, ‘hindiNumParenR’, ‘arabicPlain’, ‘circleNumDbPlain’, ‘thaiNumParenR’, ‘circleNumWdWhitePlain’, ‘alphaUcPeriod’, ‘ea1JpnKorPeriod’, ‘hindiAlphaPeriod’, ‘arabicParenR’, ‘arabicParenBoth’, ‘ea1JpnKorPlain’, ‘arabicDbPeriod’, ‘romanLcParenBoth’, ‘thaiNumParenBoth’, ‘romanUcParenR’, ‘alphaLcParenBoth’, ‘hindiAlpha1Period’, ‘hindiNumPeriod’}

    class openpyxl.drawing.text. CharacterProperties ( kumimoji=None , lang=None , altLang=None , sz=None , b=None , i=None , u=None , strike=None , kern=None , cap=None , spc=None , normalizeH=None , baseline=None , noProof=None , dirty=None , err=None , smtClean=None , smtId=None , bmk=None , ln=None , highlight=None , latin=None , ea=None , cs=None , sym=None , hlinkClick=None , hlinkMouseOver=None , rtl=None , extLst=None , noFill=None , solidFill=None , gradFill=None , blipFill=None , pattFill=None , grpFill=None , effectLst=None , effectDag=None , uLnTx=None , uLn=None , uFillTx=None , uFill=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    altLang

    Values must be of type <class ‘str’>

    b

    Values must be of type <class ‘bool’>

    baseline

    Values must be of type <class ‘int’>

    blipFill

    Values must be of type <class ‘openpyxl.drawing.fill.BlipFillProperties’>

    bmk

    Values must be of type <class ‘str’>

    cap

    Value must be one of {‘small’, ‘all’}

    cs

    Values must be of type <class ‘openpyxl.drawing.text.Font’>

    dirty

    Values must be of type <class ‘bool’>

    ea

    Values must be of type <class ‘openpyxl.drawing.text.Font’>

    effectDag

    Values must be of type <class ‘openpyxl.drawing.effect.EffectContainer’>

    effectLst

    Values must be of type <class ‘openpyxl.drawing.effect.EffectList’>

    err

    Values must be of type <class ‘bool’>

    extLst

    Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>

    gradFill

    Values must be of type <class ‘openpyxl.drawing.fill.GradientFillProperties’>

    grpFill

    Values must be of type <class ‘bool’>

    highlight

    Values must be of type <class ‘openpyxl.styles.colors.Color’>

    hlinkClick

    Values must be of type <class ‘openpyxl.drawing.text.Hyperlink’>

    hlinkMouseOver

    Values must be of type <class ‘openpyxl.drawing.text.Hyperlink’>

    i

    Values must be of type <class ‘bool’>

    kern

    Values must be of type <class ‘int’>

    kumimoji

    Values must be of type <class ‘bool’>

    lang

    Values must be of type <class ‘str’>

    latin

    Values must be of type <class ‘openpyxl.drawing.text.Font’>

    ln

    Values must be of type <class ‘openpyxl.drawing.line.LineProperties’>

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    noFill

    Values must be of type <class ‘bool’>

    noProof

    Values must be of type <class ‘bool’>

    normalizeH

    Values must be of type <class ‘bool’>

    pattFill

    Values must be of type <class ‘openpyxl.drawing.fill.PatternFillProperties’>

    rtl

    Values must be of type <class ‘bool’>

    smtClean

    Values must be of type <class ‘bool’>

    smtId

    Values must be of type <class ‘int’>

    solidFill

    Values must be of type <class ‘openpyxl.drawing.colors.ColorChoice’>

    spc

    Values must be of type <class ‘int’>

    strike

    Value must be one of {‘noStrike’, ‘dblStrike’, ‘sngStrike’}

    sym

    Values must be of type <class ‘openpyxl.drawing.text.Font’>

    sz

    Values must be of type <class ‘float’>

    tagname = 'defRPr'
    u

    Value must be one of {‘dashHeavy’, ‘heavy’, ‘dashLong’, ‘dottedHeavy’, ‘words’, ‘wavyDbl’, ‘wavyHeavy’, ‘dbl’, ‘dash’, ‘dotted’, ‘dotDash’, ‘dashLongHeavy’, ‘dotDashHeavy’, ‘sng’, ‘wavy’, ‘dotDotDashHeavy’, ‘dotDotDash’}

    uFill

    Values must be of type <class ‘bool’>

    uFillTx

    Values must be of type <class ‘bool’>

    uLn

    Values must be of type <class ‘openpyxl.drawing.line.LineProperties’>

    uLnTx

    Values must be of type <class ‘bool’>

    class openpyxl.drawing.text. EmbeddedWAVAudioFile ( name=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    name

    Values must be of type <class ‘str’>

    class openpyxl.drawing.text. Font ( typeface=None , panose=None , pitchFamily=None , charset=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    charset

    Values must be of type <class ‘int’>

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    panose
    pitchFamily

    Values must be of type <class ‘float’>

    tagname = 'latin'
    typeface

    Values must be of type <class ‘str’>

    class openpyxl.drawing.text. GeomGuide ( name=None , fmla=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    fmla

    Values must be of type <class ‘str’>

    name

    Values must be of type <class ‘str’>

    class openpyxl.drawing.text. GeomGuideList ( gd=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    gd

    A sequence (list or tuple) that may only contain objects of the declared type

    Bases: openpyxl.descriptors.serialisable.Serialisable

    action

    Values must be of type <class ‘str’>

    endSnd

    Values must be of type <class ‘bool’>

    extLst

    Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>

    highlightClick

    Values must be of type <class ‘bool’>

    history

    Values must be of type <class ‘bool’>

    id

    Values must be of type <class ‘str’>

    invalidUrl

    Values must be of type <class ‘str’>

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    snd

    Values must be of type <class ‘openpyxl.drawing.text.EmbeddedWAVAudioFile’>

    tagname = 'hlinkClick'
    tgtFrame

    Values must be of type <class ‘str’>

    tooltip

    Values must be of type <class ‘str’>

    class openpyxl.drawing.text. LineBreak ( rPr=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    rPr

    Values must be of type <class ‘openpyxl.drawing.text.CharacterProperties’>

    tagname = 'br'
    class openpyxl.drawing.text. ListStyle ( defPPr=None , lvl1pPr=None , lvl2pPr=None , lvl3pPr=None , lvl4pPr=None , lvl5pPr=None , lvl6pPr=None , lvl7pPr=None , lvl8pPr=None , lvl9pPr=None , extLst=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    defPPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    extLst

    Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>

    lvl1pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl2pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl3pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl4pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl5pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl6pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl7pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl8pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    lvl9pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    tagname = 'lstStyle'
    class openpyxl.drawing.text. Paragraph ( pPr=None , endParaRPr=None , r=None , br=None , fld=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    br

    Values must be of type <class ‘openpyxl.drawing.text.LineBreak’>

    endParaRPr

    Values must be of type <class ‘openpyxl.drawing.text.CharacterProperties’>

    fld

    Values must be of type <class ‘openpyxl.drawing.text.TextField’>

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    properties

    Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptve name is desired (eg. “underline” for “u”)

    r

    A sequence (list or tuple) that may only contain objects of the declared type

    tagname = 'p'
    text

    Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptve name is desired (eg. “underline” for “u”)

    class openpyxl.drawing.text. ParagraphProperties ( marL=None , marR=None , lvl=None , indent=None , algn=None , defTabSz=None , rtl=None , eaLnBrk=None , fontAlgn=None , latinLnBrk=None , hangingPunct=None , lnSpc=None , spcBef=None , spcAft=None , tabLst=None , defRPr=None , extLst=None , buClrTx=None , buClr=None , buSzTx=None , buSzPct=None , buSzPts=None , buFontTx=None , buFont=None , buNone=None , buAutoNum=None , buChar=None , buBlip=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    algn

    Value must be one of {‘l’, ‘just’, ‘dist’, ‘r’, ‘justLow’, ‘thaiDist’, ‘ctr’}

    buAutoNum

    Values must be of type <class ‘bool’>

    buBlip

    Values must be of type <class ‘openpyxl.drawing.fill.Blip’>

    buChar

    Values must be of type <class ‘str’>

    buClr

    Values must be of type <class ‘openpyxl.styles.colors.Color’>

    buClrTx

    Values must be of type <class ‘bool’>

    buFont

    Values must be of type <class ‘openpyxl.drawing.text.Font’>

    buFontTx

    Values must be of type <class ‘bool’>

    buNone

    Values must be of type <class ‘bool’>

    buSzPct

    Values must be of type <class ‘int’>

    buSzPts

    Values must be of type <class ‘int’>

    buSzTx

    Values must be of type <class ‘bool’>

    defRPr

    Values must be of type <class ‘openpyxl.drawing.text.CharacterProperties’>

    defTabSz

    Values must be of type <class ‘int’>

    eaLnBrk

    Values must be of type <class ‘bool’>

    extLst

    Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>

    fontAlgn

    Value must be one of {‘base’, ‘t’, ‘auto’, ‘b’, ‘ctr’}

    hangingPunct

    Values must be of type <class ‘bool’>

    indent

    Values must be of type <class ‘int’>

    latinLnBrk

    Values must be of type <class ‘bool’>

    lnSpc

    Values must be of type <class ‘openpyxl.drawing.text.Spacing’>

    lvl

    Values must be of type <class ‘int’>

    marL

    Values must be of type <class ‘int’>

    marR

    Values must be of type <class ‘int’>

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    rtl

    Values must be of type <class ‘bool’>

    spcAft

    Values must be of type <class ‘openpyxl.drawing.text.Spacing’>

    spcBef

    Values must be of type <class ‘openpyxl.drawing.text.Spacing’>

    tabLst

    Values must be of type <class ‘openpyxl.drawing.text.TabStopList’>

    tagname = 'pPr'
    class openpyxl.drawing.text. PresetTextShape ( prst=None , avLst=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    avLst

    Values must be of type <class ‘openpyxl.drawing.text.GeomGuideList’>

    prst

    Values must be of type <openpyxl.descriptors.base.Set object at 0x7f63ddf1c710>

    class openpyxl.drawing.text. RegularTextRun ( rPr=None , t='' ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    properties

    Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptve name is desired (eg. “underline” for “u”)

    rPr

    Values must be of type <class ‘openpyxl.drawing.text.CharacterProperties’>

    t

    Values must be of type <class ‘str’>

    tagname = 'r'

    Aliases can be used when either the desired attribute name is not allowed or confusing in Python (eg. “type”) or a more descriptve name is desired (eg. “underline” for “u”)

    class openpyxl.drawing.text. RichTextProperties ( rot=None , spcFirstLastPara=None , vertOverflow=None , horzOverflow=None , vert=None , wrap=None , lIns=None , tIns=None , rIns=None , bIns=None , numCol=None , spcCol=None , rtlCol=None , fromWordArt=None , anchor=None , anchorCtr=None , forceAA=None , upright=None , compatLnSpc=None , prstTxWarp=None , scene3d=None , extLst=None , noAutofit=None , normAutofit=None , spAutoFit=None , flatTx=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    anchor

    Value must be one of {‘just’, ‘dist’, ‘t’, ‘b’, ‘ctr’}

    anchorCtr

    Values must be of type <class ‘bool’>

    bIns

    Values must be of type <class ‘int’>

    compatLnSpc

    Values must be of type <class ‘bool’>

    extLst

    Values must be of type <class ‘openpyxl.descriptors.excel.ExtensionList’>

    flatTx

    Values must be of type <class ‘int’>

    forceAA

    Values must be of type <class ‘bool’>

    fromWordArt

    Values must be of type <class ‘bool’>

    horzOverflow

    Value must be one of {‘overflow’, ‘clip’}

    lIns

    Values must be of type <class ‘int’>

    namespace = 'http://schemas.openxmlformats.org/drawingml/2006/main'
    noAutofit

    Values must be of type <class ‘bool’>

    normAutofit

    Values must be of type <class ‘bool’>

    numCol

    Values must be of type <class ‘int’>

    prstTxWarp

    Values must be of type <class ‘openpyxl.drawing.text.PresetTextShape’>

    rIns

    Values must be of type <class ‘int’>

    rot

    Values must be of type <class ‘int’>

    rtlCol

    Values must be of type <class ‘bool’>

    scene3d

    Values must be of type <class ‘openpyxl.drawing.geometry.Scene3D’>

    spAutoFit

    Values must be of type <class ‘bool’>

    spcCol

    Values must be of type <class ‘int’>

    spcFirstLastPara

    Values must be of type <class ‘bool’>

    tIns

    Values must be of type <class ‘int’>

    tagname = 'bodyPr'
    upright

    Values must be of type <class ‘bool’>

    vert

    Value must be one of {‘eaVert’, ‘wordArtVertRtl’, ‘horz’, ‘vert’, ‘wordArtVert’, ‘mongolianVert’, ‘vert270’}

    vertOverflow

    Value must be one of {‘overflow’, ‘clip’, ‘ellipsis’}

    wrap

    Value must be one of {‘square’, ‘none’}

    class openpyxl.drawing.text. Spacing ( spcPct=None , spcPts=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    spcPct

    Values must be of type <class ‘int’>

    spcPts

    Values must be of type <class ‘int’>

    class openpyxl.drawing.text. TabStop ( pos=None , algn=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    algn

    Values must be of type <openpyxl.descriptors.base.Set object at 0x7f63ddd8d0d0>

    pos

    Values must be of type <class ‘openpyxl.descriptors.base.Integer’>

    class openpyxl.drawing.text. TabStopList ( tab=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    tab

    Values must be of type <class ‘openpyxl.drawing.text.TabStop’>

    class openpyxl.drawing.text. TextField ( id=None , type=None , rPr=None , pPr=None , t=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    id

    Values must be of type <class ‘str’>

    pPr

    Values must be of type <class ‘openpyxl.drawing.text.ParagraphProperties’>

    rPr

    Values must be of type <class ‘openpyxl.drawing.text.CharacterProperties’>

    t

    Values must be of type <class ‘str’>

    type

    Values must be of type <class ‘str’>

    class openpyxl.drawing.text. TextNormalAutofit ( fontScale=None , lnSpcReduction=None ) [source]

    Bases: openpyxl.descriptors.serialisable.Serialisable

    fontScale

    Values must be of type <class ‘int’>

    lnSpcReduction

    Values must be of type <class ‘int’>