1 Star 0 Fork 0

dzc/Python-1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
read_excel_file.py 636 Bytes
一键复制 编辑 原始数据 按行查看 历史
w3x10e8 提交于 2018-08-24 09:23 +08:00 . Read-Write Excel files with python
# extract number of rows using Python
import xlrd
# Give the location of the file
loc = ("sample.xlsx")
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
sheet.cell_value(0, 0)
# Extracting number of rows
print(sheet.nrows)
# extract number of columns in Python
print(sheet.ncols)
# extracting all columns name in Python
for i in range(sheet.ncols):
print(sheet.cell_value(0, i))
#extracting first column
sheet = wb.sheet_by_index(0)
for i in range(sheet.nrows):
print(sheet.cell_value(i, 0))
#extract a particular row value
sheet = wb.sheet_by_index(0)
print(sheet.row_values(1))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sdredboy/Python-1.git
git@gitee.com:sdredboy/Python-1.git
sdredboy
Python-1
Python-1
master

搜索帮助