程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python controls Excel to realize office automation

編輯:Python

1.Install

2. Operate a simple Excel document

Operation comment and code:

After the operation is complete, the data storage result is as follows:

3. Simple operation of Excel document and adding data format

The operation code is as follows: Definition of attached data format

The operation effect is as shown in the figure:

4.Add different types of data in Excel

The operation code is as follows: add different data to the file according to the specified format


The code execution result is as follows:

Note: xlsxwriter provides multiple ways to write data to excel,As follows:

  • write_string()[https://xlsxwriter.readthedocs.io/worksheet.html#write_string]

  • write_number()[https://xlsxwriter.readthedocs.io/worksheet.html#write_number]

  • write_blank()[https://xlsxwriter.readthedocs.io/worksheet.html#write_blank]

  • write_formula()[https://xlsxwriter.readthedocs.io/worksheet.html#write_formula]

  • write_datetime()[https://xlsxwriter.readthedocs.io/worksheet.html#write_datetime]

  • write_boolean() [https://xlsxwriter.readthedocs.io/worksheet.html#write_boolean]

  • write_url()[https://xlsxwriter.readthedocs.io/worksheet.html#write_url]

5.Add data chart to Excel

The operation code is as follows: add the corresponding data display chart to the file

The code execution result is shown in the following figure:

Finally: a tutorial that might help you

These materials, as well as the above interview question resources, should be the most comprehensive and complete preparation warehouse for friends who do software testing. This warehouse has also accompanied me through the most difficult journey, and I hope it can also help you!Everything should be done as early as possible, especially in the technology industry, we must improve our technical skills.Hope it will be helpful to you all...

I wish you all the best offers~~


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved