Reading an excel file using Python

Configurare noua (How To)

Situatie

Using xlrd module, one can retrieve information from a spreadsheet. For example, reading, writing or modifying the data can be done in Python. Also, user might have to go through various sheets and retrieve data based on some criteria or modify some rows and columns and do a lot of work.

Solutie

Pasi de urmat

 

# Reading an excel file using Python
import xlrd

# Give the location of the file
loc = (“path of file”)

# To open Workbook
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)

# For row 0 and column 0
print(sheet.cell_value(0, 0))

 

Output: Test1

Tip solutie

Permanent

Voteaza

(7 din 19 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?