跳至内容
菜单
此问题已终结
2 回复
2917 查看

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

形象
丢弃
相关帖文 回复 查看 活动
1
5月 23
4022
0
9月 24
1437
0
3月 18
3555
0
7月 17
7846
1
11月 16
3003