title: Python, iterating through an excel spreadsheet
body: <p>I need to write the program that loops through the columns of data. Resetting the variable based on the cell value and each column representing a variable.</p>
  
  <p>The variables in the exercise are dependent on these values that are being looped through. </p>
  
  <p>How can I loop through the rows with each iteration of the loop increasing the value by 1?</p>
  
  <pre><code>df=pd.DataFrame(r'C:/Users/user.name/Desktop/P_list.xlsx',sheet_name = 'Sheet1')
  for i in range(0,5000):
  
      df2 = pd.read_excel(r'C:/Users/user.name/Desktop/P_list.xlsx',sheet_name = 'Sheet1'), index = list(range(i,5000,1), columns=list(range(0)))
      df3 = pd.read_excel(r'C:/Users/user.name/Desktop/P_list.xlsx',sheet_name = 'Sheet1'), index = list(range(i,5000,1), columns=list(range(1)))
      df4 = pd.read_excel(r'C:/Users/user.name/Desktop/P_list.xlsx',sheet_name = 'Sheet1'), index = list(range(i,5000,1), columns=list(range(2)))
      df5 = pd.read_excel(r'C:/Users/user.name/Desktop/P_list.xlsx',sheet_name = 'Sheet1'), index = list(range(i,5000,1), columns=list(range(3)))
      firstname = df2
      lastname = df3
      address = df4
      number= df5
  
  #performed exercise
  
  </code></pre>