Created
November 23, 2017 16:34
-
-
Save inazense/f620394d1e8f8959fa0ed848f7af5508 to your computer and use it in GitHub Desktop.
Lector ficheros XLSX con Python3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from openpyxl import load_workbook # Requiere instalar openpyxl | |
import os.path | |
rutaXLSX = "fichero.xlsx" | |
if os.path.isfile(rutaXLSX): | |
libro = load_workbook(rutaXLSX) # Abro el excel para extraer los campos | |
hoja = libro.get_sheet_by_name(libro.get_sheet_names()[0]) # Cojo la primera hoja | |
for fila in hoja.rows: | |
for celda in fila: | |
print(celda.value) | |
else: | |
print("No se ha reconocido el fichero") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment