Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2879 มุมมอง

I want to put this data in the following form using xlsxwriter, any help please?

'my_list': [
        {'field1': 'xxxxx', 'field2': [
                {'A': 'xxxx_01', 'B': 100
                },
                {'A': 'xxxx_02', 'B': 200
                },
                {'A': 'xxxx_03', 'B': 300
                },
                {'A': 'xxxx_04', 'B': 400
                },
            ]
        }
        
    ]


อวตาร
ละทิ้ง

If i understand well you get this data let's say from odoo db and want to put them inside the excel sheet ?

ผู้เขียน

@ABDOU NASSER, Yes I want to do it by using sheet.write_column(....) , but still having problem.Thanks.

คำตอบที่ดีที่สุด

Hi,

Try like following

row = 6
for record in my_list:
row_mem = row
for rec in record['field2']:
sheet.write(row, 1, rec['A'])
sheet.write(row, 2, rec['B'])
row += 1
sheet.merge_range(row_mem, 0, row-1, 0, record['field1'])

Regards

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

 i understand well you get this data

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 23
3985
0
ก.ย. 24
1416
0
มี.ค. 18
3541
0
ก.ค. 17
7831
1
พ.ย. 16
2976