0
input_list = [['as','as*s','sd','*ssa'],['a','ds','dfg','mal']]

I want this to be written into an excel sheet (XLS format) where each sublist is a row in the excel sheet (XLS format)

for my case, it is best to preserve the input as a nested list, but if that is not possible, I am willing to 'unpack' the nested list into something like this

modified_input_list = ['as','as*s','sd','*ssa','a','ds','dfg','mal']

and then write every 4 elements into a row into the excel sheet (XLS format)

it is very important the solution being provided takes into consideration that the rows are being written into an excel sheet of XLS format ONLY. I have imported XLRD to read other XLS type sheets, and there is no need to state that import in the solution.

Thanks in advance

Patrick
  • 1,189
  • 5
  • 11
  • 19
Zenith_1024
  • 231
  • 2
  • 14
  • https://stackoverflow.com/questions/2942889/reading-parsing-excel-xls-files-with-python/50815107 is a good starting point. However, if need be, you can save as a csv and resave it as an .xls in the excel program manually. Also, you can use pandas.ExcelFile() as another starting point – Larry the Llama Nov 22 '21 at 04:46
  • Is `xlsx` format OK? – Jerry An Nov 22 '21 at 04:51
  • df = pd.DataFrame(input_list) df.to_excel('test.xlsx', sheet_name='Sheet1') – Jerry An Nov 22 '21 at 04:52
  • no i need in XLS format only, i dont want to manually change from csv to xls – Zenith_1024 Nov 22 '21 at 05:11

0 Answers0