![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Automate the boring stuff with pyth
chaoqichaoluoe
Transform!
展开
-
chapter12——working with excel spreadsheet(1)
import openpyxl wb = openpyxl.load_workbook('filename.xlsx') sheet = wb['Sheetname'] # sheet = wb.get_sheet_by_name('Sheetname') 的方法已经弃用 one_cell = sheet['A1'] cell_range = sheet['A1':'C2'] # 获得单个数据和多...原创 2019-09-13 14:57:02 · 168 阅读 · 0 评论 -
chapter12——working with excel spreadsheet(2)
Project:更新excel表格单元 import openpyxl wb = openpyxl.load_workbook('produceSales.xlsx') sheet = wb['Sheet'] # 要更新的内容 PRICE_UPDATES = { 'Garlic':3.07, 'Celery':1.19, 'Lemon':1.27, } for rowNu...原创 2019-09-16 20:58:53 · 156 阅读 · 0 评论 -
chapter12——Practice Projects
1. 制造乘法表 import openpyxl from openpyxl.utils import get_column_letter from sys import argv # 使用argv获取程序名和变量名,方可使用脚本打开该文件 script, N = argv # 输入默认是str文件,必须int转换 N = int(N) wb = openpyxl.Workbook() she...原创 2019-09-16 21:21:53 · 62 阅读 · 0 评论