Python Forum
Python3 openpyxl module - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python3 openpyxl module (/thread-28883.html)



Python3 openpyxl module - GHULIEV - Aug-07-2020

Hello everyone i need help for data write to excel file. this is my script
    target = 'site.com'
    api = "api"
    limit = 5
    url = "https://site.com/v2/domain-search?domain=" + target + "&api_key=" + api + "&limit=" + str(limit)
    response = requests.get(url)
    jsonResponse = response.json()
    excel_file = openpyxl.load_workbook('test.xlsx')
    ws = excel_file.active
    excel_sheet = excel_file['Sheet']
    column = ws.max_column+1
    row = 1

    for email in jsonResponse['data']['emails']:

        final1 = str(email['value'])
        print (final1+'\n')
        excel_sheet.cell(row=row, column=column).value = final1
        row +=1
        excel_file.save('test.xlsx')
currently version
[Image: tvxzgf]
https://prnt.sc/tvxzgf
but i need this structure

[Image: tvxzsq]
https://prnt.sc/tvxzsq
please help me