close

How to write a list of list into excel using python?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to write a list of list into excel using python in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to write a list of list into excel using python?

  1. How to write a list of list into excel using python?

    I think the most convenient way is to use Series in Pandas.
    import pandas as pd

  2. write a list of list into excel using python

    I think the most convenient way is to use Series in Pandas.
    import pandas as pd

Method 1

Here is one way to do it using XlsxWriter:

import xlsxwriter

new_list = [['first', 'second'], ['third', 'four'], [1, 2, 3, 4, 5, 6]]

with xlsxwriter.Workbook('test.xlsx') as workbook:
    worksheet = workbook.add_worksheet()

    for row_num, data in enumerate(new_list):
        worksheet.write_row(row_num, 0, data)

Output:

enter image description here

Method 2


I think the most convenient way is to use Series in Pandas.

import pandas as pd

new_list =['whatever']
pd.Series(new_list)
new_list.to_excel('aFileName.xlsx')

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read