Python Forum

Full Version: Python3 openpyxl module
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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