Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [PYTHON] Leggere un file Excel con Python

    Ciao a tutti,
    Sto cercando di aprire un file excel con python usando il codice:

    codice:
    import openpyxl
    file_excel = openpyxl.load_workbook('Tab_rev01.xlsx')
    sheet = wb.get_sheet_by_name('Sheet1')
    print(sheet['A1']
    Ma mi da un errore del tipo:

    Traceback (most recent call last):
    File "C:\Users\...\test1.py", line 3, in <module>
    sheet = wb.get_sheet_by_name('Sheet1')
    NameError: name 'wb' is not defined

    La guida che sto seguendo è questa: https://devnews.it/posts/59678962664...ython-openpyxl

    Avete qualche idea su cosa puo causare questo errore?

    Grazie mille

  2. #2
    Utente di HTML.it L'avatar di clasku
    Registrato dal
    Aug 2006
    Messaggi
    3,197
    Cambia wb con file_excel (o viceversa)

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.