-3

I am absolute beginner and don't know how to do it. Could you please advise me how to turn excel row to a Python list? The next row should be the next list and so on.

Cognition
  • 11
  • 1
  • 2
  • 3
    Hi! Start with googling this question and having a try on your own. Low research/no attempt questions get downvoted. – timgeb Nov 14 '18 at 19:31
  • Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. [On topic](http://stackoverflow.com/help/on-topic), [how to ask](http://stackoverflow.com/help/how-to-ask), and [... the perfect question](https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) apply here. StackOverflow is not a design, coding, research, or tutorial resource. – Prune Nov 14 '18 at 19:38
  • 1
    Possible duplicate of [Read data in Excel column into Python list](https://stackoverflow.com/questions/45708626/read-data-in-excel-column-into-python-list) – IanQ Nov 14 '18 at 20:01

3 Answers3

1

https://www.geeksforgeeks.org/reading-excel-file-using-python/ this should get you started. If you still have issues post some code/attempts so we can further help.

0

Assuming a csv file named test:

with open("test.csv", "r") as f:
    for line in f:
        print(line)

Will print open the file in read-only mode then loop over the lines, storing each of them in the variable "line" and printing them. Read section 7.2 here for more details.

0

Simple way to Excel rows to the list of the lists:

import pandas as pd

df = pd.read_excel("/Path/File_Name.xlsx", sheet_name='Sheet Name')
df.values.tolist()
Ivan Sushkov
  • 75
  • 1
  • 7