The python + openpyxl excel associated reader

DEF the Test (): 
    wb2 = openpyxl.Workbook ()    # Create an excel objects 
    wb2.save ( " a.xlsx " )           # save excel and named a.xlsx 

    wb2 = openpyxl.load_workbook ( ' a.xlsx ' )   # load excel data 
    sheets2 = wb2.sheetnames                 # acquired excel sheet of the set of tables 
    Sheet2 = WB2 [sheets2 [0]]                 # Get the first sheet excel table 
    Print (Sheet2 [ ' A1 ' ] .Value) 
    Sheet2 [ ' A1 ' ]. = value " My"                  # Set the first value sheet table is My 
    Print (Sheet2 [ ' A1 ' ] .Value) 
    wb2.save ( ' b.xlsx ' )                       # save this excel as b.xlsx, remember to save otherwise not write go 
    wb2.close ()

 

Guess you like

Origin www.cnblogs.com/lelexiong/p/11274521.html