当前位置:网站首页>Openpyxl table reading instance
Openpyxl table reading instance
2022-06-27 10:16:00 【Is it far? My Shangri La】
from openpyxl import load_workbook
# Read data from tables
def read_data_from_excel(excel_path,sheet_name):
wb = load_workbook(filename=excel_path,read_only=True)
# Read the specified page
ws = wb[sheet_name]
#-----------< Print a single cell (A4) Value >-------------------#
d=ws.cell(row=4,column=1)
print(d.value)
#-----------< Print a single cell (A4) Value >-------------------#
#-----------< Store the value of a region in a two-dimensional array >-------------#
data_arr=[]
for row in ws.iter_rows(min_row=3,max_row=6,max_col=4):
tmp=[] # The values of each row are stored in the array
for cell in row:
tmp.append(cell.value)
data_arr.append(tmp)
return data_arr
#-----------< Store the value of a region in a two-dimensional array >-------------#
# Call parameters
excel_path="./test.xlsx"
# Calling method
data_arr=read_data_from_excel(excel_path,"NVR")
print(data_arr)
边栏推荐
- unity--newtonsoft. JSON parsing
- Use aspese slides to convert PPT to PDF
- Arduino PROGMEM静态存储区的使用介绍
- BufferedWriter 和 BufferedReader 的使用
- Xiaobai can also understand how the basic network 03 | OSI model works (classic push)
- 【OpenCV 例程200篇】211. 绘制垂直矩形
- C language learning day_ 04
- C# Any()和AII()方法
- leetcode待做题目
- R語言plotly可視化:可視化多個數據集歸一化直方圖(historgram)並在直方圖中添加密度曲線kde、設置不同的直方圖使用不同的分箱大小(bin size)、在直方圖的底部邊緣添加邊緣軸須圖
猜你喜欢

C语言学习-Day_06

【报名】基础架构设计:从架构热点问题到行业变迁 | TF63

Google browser chropath plug-in
![[200 opencv routines] 212 Draw a slanted rectangle](/img/cf/da8fff386d011c939946326c55671f.png)
[200 opencv routines] 212 Draw a slanted rectangle

Explain the imaging principle of various optical instruments in detail

The tutor invites you to continue your doctoral study with him. Will you agree immediately?

Analysis of mobile ar implementation based on edge computing (Part 2)

Win10快捷键整理

LVI Sam summary

Product strength benchmarking seal /model 3, with 179800 pre-sales of Chang'an dark blue sl03
随机推荐
Exception in Chinese character fuzzy query of MySQL database
The R language uses the preprocess function of the caret package for data preprocessing: Center all data columns (subtract the average value from each data column), and set the method parameter to cen
es 根据索引名称和索引字段更新值
Ubuntu手动安装MySQL
技术与业务同等重要,偏向任何一方都是错误
C language learning day_ 06
R语言使用econocharts包创建微观经济或宏观经济图、demand函数可视化需求曲线(demand curve)、自定义配置demand函数的参数丰富可视化效果
Advantages and disadvantages of distributed file storage system
I'm almost addicted to it. I can't sleep! Let a bug fuck me twice!
一次线上移动端报表网络连接失败问题定位与解决
Google browser chropath plug-in
10 common website security attack means and defense methods
Easy to understand Laplace smoothing of naive Bayesian classification
[200 opencv routines] 211 Draw vertical rectangle
软交换呼叫中心系统的支撑系统
DNS standby server information, DNS server address (how many DNS preferred and standby are filled in)
【HCIE-RS复习思维导图】- STP
分布式文件存储系统的优点和缺点
How do I get the STW (pause) time of a GC (garbage collector)?
用户认证技术