Python operates Excel to make visual data map to realize office automation

Time:2021-12-30

preface

The text and pictures of this article come from the network, only for learning and communication, and do not have any commercial purpose. If you have any questions, please contact us in time for handling.

The following article is from getting started with it

Python operates Excel to make visual data map to realize office automation

 

install

Python operates Excel to make visual data map to realize office automation

 

Operate a simple excel document

Operation notes and codes:

Python operates Excel to make visual data map to realize office automation

 

After the operation is completed, the data storage results are as follows:

Python operates Excel to make visual data map to realize office automation

 

Easy to operate EXCEL documents and add data formats

The operation code is as follows: the definition of data format is attached

Python operates Excel to make visual data map to realize office automation

 

The operation effect is shown in the figure:

Python operates Excel to make visual data map to realize office automation

 

Add different types of data to excel

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

Python operates Excel to make visual data map to realize office automation

 

The code execution results are as follows:

Python operates Excel to make visual data map to realize office automation

 

Note: xlsxwriter provides several 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 in Excel

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

Python operates Excel to make visual data map to realize office automation

 

The code execution results are shown in the following figure:

Python operates Excel to make visual data map to realize office automation