Copy column from excel to array in python


I have values in an excel sheet that I want to easily transfer to my Python code. Is there any easy way to select all the cells you want from the sheet and then copy-paste them into the text editor with each cell value separated with a comma?

>Solution :

You may use pandas to do it:

import pandas as pd
df = pd.read_excel('your_file.xslx', sheetname='your_sheet_name')
your_array = df['your_column_name'].toarray()

Leave a ReplyCancel reply