python电子表格类_python xlsxwriter 设置excel电子表格 活动工作表

最近在用pandas写xlsx,用的xlsxwriter,想要指定excel表格打开时显示的工作表,百度了很长时间没有找到。dir出一堆方法,也不知道哪个是。今天无意间终于翻到了。workbook1 = writer.book

worksheet1 = writer.sheets['sheet3']

worksheet1.activate() # 指定活动工作表

顺便把其他方法也贴在下面。方便下次查阅。

write_row(row, col, data, cell_format=None)    从行(col)开始写,列固定

write_column(row, col, data, cell_format=None)    从列(row)开始写,行固定

insert_image(row, col, filename, options=None)    插入图片 filename:PNG、JPG或BMP格式的图像的路径和文件名。

insert_textbox(row, col, text, options=None)    插入文本框

insert_chart(row, col, chart, options=None)    插入图表options 图表的位置和规模

write_comment(row, col, comment, options=None)    为单元格添加注释show_comments展示单元格注释

set_comments_author(author)    设置评论作者

get_name()    获取工作表的名称

activate()    将工作表设置为活跃的,打开excel 第一个显示的表

select()    将工作表设置为选中工作表,高亮显示

hide()    隐藏选中的工作表

set_column(firstcol, lastcol,width=None,cell_format=None, options=None)    设置列的宽度

set_first_sheet()    将当前工作表设置为第一个可见的表

set_row(row, height=None, cell_format=None, options=None)    设置行的宽度及其他属性值

set_default_row(self, height=None, hide_unused_rows=False)    设置默认行属性 hide_unused_rows: 隐藏未使用的行

merge_range(first_row, first_col, last_row,last_col,data, cell_format=None)    合并单元格

autofilter(first_row, first_col, last_row, last_col)    在工作表中设置自动过滤区域

filter_column(self, col, criteria)    设置筛选滤条件 criteria: 筛选条件

filter_column_list(self, col, filters)    在excel2007 列表样式中设置筛选标准

data_validation(first_row, first_col, last_row, last_col,options)    添加数据验证

conditional_format(first_row, first_col, last_row, last_col,options=None)    向工作表中添加一个条件格式

add_table(self, first_row, first_col, last_row, last_col,options=None)    向excel中添加一个工作表

add_sparkline(self, row, col, options)    添加微线图

set_selection(first_row, first_col, last_row, last_col)    设置选定的单元格dset_zoom(zoom=100)设置缩放 10-400

freeze_panes( row, col, top_row=None, left_col=None, pane_type=0)    创建工作表窗格,并设置为冻结

split_panes(x, y, top_row=None, left_col=None)    创建工作表窗格,并将其标记为分割 x:垂直分割的位置。y:水平分割的位置。toprow:在窗格的滚动区域中最可见的行。left_col:在窗格的滚动区域中最可见的行。

hide_zero()    自工作表中隐藏0值

set_tab_color(color)设置 工作表选项卡的颜色

protect(password='', options=None)    设置工作的密码和保护项 options: 用于保护的工作表对象的字典

insert_button(row, col, options=None)    插入一个button表单对象

set_footer(footer='', options=None, margin=None)    设置页脚标题和可选的页边距

set_header(header='',options=None,margin=None)    设置页面标题标题和可选的页边距

set_margins(left=0.7, right=0.7, top=0.75, bottom=0.75)    将所有的页边距设置为英寸

set_paper(self, paper_size)    设置纸张类型 papaer_size: A4=9

set_portrait()    将页面朝向设置为竖向

set_landscape()    将页面的朝向设置为横向

联系我时,请说是在唐河信息平台看到的,谢谢!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值