Advertisement
teslariu

openpy

Oct 18th, 2021
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. from openpyxl import Workbook
  5. libro = Workbook()
  6.  
  7. # grab the active worksheet
  8. hoja = libro.active
  9.  
  10. # Data can be assigned directly to cells
  11. hoja['A1'] = 42
  12.  
  13. # Rows can also be appended
  14. hoja.append([1, 2, 3])
  15.  
  16. # Python types will automatically be converted
  17. import datetime
  18. hoja['A3'] = datetime.datetime.now()
  19.  
  20. # Save the file
  21. libro.save("MUESTRA.xlsx")
Advertisement
RAW Paste Data Copied
Advertisement