import pyexcel
# Get the data
new_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
# Save the array to a file
pyexcel.save_as(array=new_list, dest_file_name="array_data.xls")
# Retrieve the records of the file
records = pyexcel.get_records(file_name="test.xls")
# Get an array from the data
my_array = pyexcel.get_array(file_name="test.xls")
# Get your data in a dictionary of 2D arrays
2d_array_dictionary = pyexcel.get_book_dict(file_name="test.xls")
# The data
2d_array_dictionary = {'Sheet 1': [
['ID', 'AGE', 'SCORE']
[1, 22, 5],
[2, 15, 6],
[3, 28, 9]
],
'Sheet 2': [
['X', 'Y', 'Z'],
[1, 2, 3],
[4, 5, 6]
[7, 8, 9]
],
'Sheet 3': [
['M', 'N', 'O', 'P'],
[10, 11, 12, 13],
[14, 15, 16, 17]
[18, 19, 20, 21]
]}
# Save the data to a file
pyexcel.save_book_as(bookdict=2d_array_dictionary, dest_file_name="2d_array_data.xls")
openpyxlorxlwingsto write into a file withxl/xlsformat. But, you should be able to open your csv file in Excel right?