Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python3 openpyxl module
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Openpyxl module breaking my code EnderSM 5 1,066 May-26-2023, 07:26 PM
Last Post: snippsat
  Python3 doesn't populate xlsx file with openpyxl Auldyin75 2 2,542 Feb-16-2021, 12:00 PM
Last Post: Auldyin75
  [split] openpyxl workbook module not callable yosoyebj 1 2,794 Sep-14-2020, 10:18 AM
Last Post: buran
  Cannot use "threading" module on python3 Tei_tsubaki 1 3,059 Aug-24-2020, 10:26 AM
Last Post: Larz60+
  Error after installing Python3.8.2: "No module named 'apt_pkg'" Chromie 3 3,885 Mar-09-2020, 08:20 PM
Last Post: micseydel
  Unable to write to excel - Using openpyxl module starstud 2 4,483 Feb-05-2020, 03:53 AM
Last Post: starstud
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 4,915 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Getting error while loading excel(.xlsx) file using openpyxl module shubhamjainj 1 8,979 Mar-01-2019, 01:05 PM
Last Post: buran
  Could not build the ssl module while installing python3.7 from tar ball badfish 1 7,838 Dec-11-2018, 04:33 AM
Last Post: badfish
  Anybody good with the Openpyxl module? I've got a bug I can't solve. pcsailor 0 2,031 Sep-19-2018, 04:31 AM
Last Post: pcsailor

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020