import xlsxwriter
# new Execl file, called test1. XLSX
Workbook=xlsxwriter. Workbook (' test1. XLSX)
# new table, the name of "Chinese"
Worksheet=workbook. Add_worksheet (name='visual')
Worksheet. Write (0, 0, 'address connection') # the first parameter is the line, the second is the column, the third is a content
# worksheet. Write (1, 0, 2)
# worksheet. Write (2, 0, 3.001)
# worksheet. Write (3, 0, '=SIN (PI)/4)')
# worksheet. Write (4, 0, 'none')
# set links, links to Sheet2 table
Worksheet. Write (5, 0, '=the HYPERLINK (" result \ ", "images folder")')
Hyperlinks in the code can only be positioned to the folder, and not specifically open a picture,
To realize the contents of the A2 click open 001. JPG, A3 content in open 002. JPG and so on, how to implement?
The appearance of such as the following figure

CodePudding user response:
Don't know what will you do the last of the code, if you're going to get pictures from "image folders in this folder, why the name of a folder, and haven't cycle, head to get all of the pictures,Altered this is my code:
import xlsxwriter
The import OS
# new Execl file, called test1. XLSX
Workbook=xlsxwriter. Workbook (' test1. XLSX)
# new table, the name of "Chinese"
Worksheet=workbook. Add_worksheet (name='visual')
Worksheet. Write (0, 0, 'address connection') # the first parameter is the line, the second is the column, the third is a content
Pics=OS. Listdir ('/pictures folder ')
For PIC in pics:
Worksheet. Write (pics. Index (PIC) + 1, 0, '=the HYPERLINK (" picture folder/{} ", "{}")'. The format (PIC, the PIC))
Workbook. The close ()
CodePudding user response: