当前位置: 首页 > news >正文

石家庄做网站时光百度知道推广软件

石家庄做网站时光,百度知道推广软件,响应式外贸建站,网站集成微信登陆批量新增excel文件 import osimport xlwings as xwapp xw.App(visibleTrue,add_bookFalse)#visible设置为ture的时候会自动打开创建的excel文件,设为为false的时候不会看到excel文件打开了,实际进程占用了....dept_list [人事部,财务部,研发部,行政部…
  1. 批量新增excel文件

    	import osimport xlwings  as xwapp = xw.App(visible=True,add_book=False)#visible设置为ture的时候会自动打开创建的excel文件,设为为false的时候不会看到excel文件打开了,实际进程占用了....dept_list = ['人事部','财务部','研发部','行政部']path = os.path.abspath(os.path.abspath(os.path.dirname(__file__)))dept_path = os.path.join(path,'excel文件')for dept in dept_list:workbook = app.books.add()workbook.save(f'{dept_path}/部门业绩-{dept}.xlsx')
    
  2. 批量打开excel文件

    import os
    import xlwings  as xw
    app = xw.App(visible=True,add_book=False)
    for dir,curdir,files in os.walk(dept_path):if files:for  file in files:file_path = os.path.join(dir,file)if file.endswith('.xlsx'):app.books.open(file_path)
    
  3. 批量修改excel文件工作表名

     import osimport xlwings  as xwapp = xw.App(visible=False,add_book=False)path = os.path.abspath(os.path.abspath(os.path.dirname(__file__)))dept_path = os.path.join(path,'excel文件')#批量修改  【部门业绩-行政部.xlsx  】 这个文件的工作表名workbook =app.books.open(f'{dept_path}\部门业绩-行政部.xlsx')for sheet in workbook.sheets:sheet.name = sheet.name.replace('Sheet','部门')workbook.save()app.quit()
    

4.合并相似excel文件内容到一个excel(只会合并每个excel第一个sheet页的内容)

	import pandas as pddata_list = []for dir,curdir,files in os.walk(dept_path):if files:for  file in files:file_path = os.path.join(dir,file)if file.endswith('.xlsx') and file.startswith('部门业绩-'):data_list.append(pd.read_excel(file_path))data_all = pd.concat(data_list)data_all.to_excel('部门业绩.xlsx')
  1. 合并一个excel文件多个sheet页内容到第一个sheet页中

    
    import pandas as pd
    import xlwings as xw
    file = f'{dept_path}\部门业绩-行政部.xlsx'
    df_list = pd.read_excel(file,sheet_name=None)
    df_all = pd.concat(df_list.values())
    app=xw.App(visible=False,add_book=False)
    workbook = app.books.open(file)
    workbook.sheets.add('汇总表',before=workbook.sheets[0])
    workbook.sheets['汇总表'].range('A1').options(index=False).value=df_all
    workbook.save()
    workbook.close()
    app.quit()
    
  2. 拆分excel表(按照某个分类拆分成不同的excel表)

    import pandas as pd
    file = f'{dept_path}\产品表.xlsx'
    df= pd.read_excel(file)
    products = df['产品类型'].unique()  #去重获取产品类型这一列所有产品for product in products:df_product = df[df['产品类型']==product]df_product.to_excel(f'{dept_path}\产品表-{product}.xlsx')
    
  3. 拆分excel表(按照某个分类拆分成不同的sheet页)

    import pandas as pd
    file = f'{dept_path}\采购表.xlsx'
    #读取所有sheet页
    df_list= pd.read_excel(file,sheet_name=None,parse_dates=False)
    #合并成一个大数据表
    df_all = pd.concat(df_list.values())file2 = f'{dept_path}\采购表-按产品类分.xlsx'
    excel_writer = pd.ExcelWriter(file2,date_format='YYYY-MM-DD')
    for product,df in df_all.groupby('产品类型'):df.to_excel(excel_writer,product,index=False)
    excel_writer.save()
  4. 比较2个excel文件内容

    import os
    import xlwings  as xwapp = xw.App(visible=False,add_book=False)
    file = f'{dept_path}\产品表.xlsx'
    file_back = f'{dept_path}\产品表-备份.xlsx'
    book = app.books.open(file)
    book_backup = app.books.open(file_back)for row in book.sheets[0].range('A1').expand():for cell in row:backup_cell = book_backup.sheets[0].range(cell.address)if cell.value != backup_cell.value:cell.color = backup_cell.color = (255,0,0)
    book.save()
    book.close()
    book_backup.save()
    book_backup.close()
    app.quit()
    
http://www.yidumall.com/news/105071.html

相关文章:

  • 威客网站开发网站设计用什么软件
  • 网站制作公司兴田德润怎么联系南宁优化网站收费
  • 做网页的软件h找seo外包公司需要注意什么
  • 做幼儿园网站网站推广方式
  • 网站建设渠道怎么做好推广和营销
  • 寻找做网站的百度快照功能
  • 外贸网站建设是什么关键词搜索工具爱站网
  • 商贸公司寮步网站建设关键词推广
  • 网站建设制作设计营销 上海泰州seo网络公司
  • 鄂尔多斯公司网站建设windows优化大师怎么彻底删除
  • 做网站 要学 什么语言网络营销的概念和特征
  • 网上花店网站建设规划书公司以优化为理由裁员合法吗
  • 广州网站建设骏域网站茂名网络推广
  • 网页编辑岗位职责和任职要求石家庄seo关键词排名
  • 做网站公司怎么找客户论坛推广的步骤
  • 网站首页的psd怎么做如何进行品牌营销
  • 微信h5网站开发重庆seo的薪酬水平
  • 湛江做网站百度地图在线查询
  • 长安网站建设培训机构重庆seo网络推广平台
  • 传动设备 技术支持 东莞网站建设seo搜索引擎优化哪家好
  • 网站开发集成软件今日百度搜索风云榜
  • 巴中做网站 微信开发石家庄网站优化
  • php做简单网站教程视频教程怎么建立一个自己的网站
  • vs网站开发入门德州百度推广公司
  • 快速搭建网站页面电商网站制作
  • python做网站框架seo研究中心南宁线下
  • 网站升级需要什么网站快速收录
  • 瓷砖网络推广培训洛阳搜索引擎优化
  • 腾讯网站谁做的天津网站优化公司
  • 国家企业年审营业执照官网朝阳seo