Aquesta és una revisió antiga del document


Curso python + openpyxl (excel)

  • udemy
import openpyxl
import os
 
os.getcwd()
os.chdir(path)
 
wb=openpyxl.load_workbook('...xlsx')
type(wb)
wb.get_sheet_names()
sheet=wb.get_sheet_by_name('pestanya')
type(sheet)
sheet.title
sheet.max_row
sheet.max_column
sheet.title='nou nom'
sheet.save('file.xlsx')
for i in range(1,sheet.max_column+1):
  e=sheet.cell(row=1,column=i)
  print(e.value,end=' ')
 
lista = []
for i in range(1,5):
  e=sheet.cell(row=5,column=i)
  lista.append(e.value)

</code>

  • info/cursos/python/openpyxl.1633679168.txt.gz
  • Darrera modificació: 08/10/2021 00:46
  • per mate