python读取excel,python版本3.8.1,使用xlrd
先安装xlrd
打开powershell
输入
pip install xlrd
安装好后,
我试着找了几个网上打开excel的命令,都不对。
摸索到最新命令如下
如读取E:\bc\1.xlsx
import xlrd
data = xlrd.open_workbook("E://bc/1.xlsx")
# 读第0张工作表
sheet = 0
# 读第1行
start_row = 1
# 获取第0张工资表
sh = data.sheet_by_index(sheet)
# sh.nrows 表示所有行
for rx in range(start_row, sh.nrows):
column = 1
# 取第rx行的column列单元格的值
title = sh.row(rx)[column].value
print(title)
我之前使用按键精灵实现自动化。现在在家,摸索着零基础学习python。
希望把自己摸索的地方写出来。大部分有基础的人可能看着有点幼稚。不好意思