OpenPyXl - Looping through cells until condition












0















Excel's column A has many rows with different values. Example:



613
613
613
625
625
631
631...etc


I want to iterate through column A and when the cell's value refers to a new value, obtain the cell's row.



Expected result example:
When the cell's value changed to 625, it will return the row 4. When 631, 6, and so on.



This is my code so far:



from openpyxl import Workbook, load_workbook

wb = load_workbook("Workbook.xlsx")
ws = wb.active
sheet = wb["Visual Query2"]

for row in ws.iter_rows(min_row=1, max_col=1, max_row=223181):
for cell in row::
print(cell.row)


I got a bit lost when trying to catch when the cell starts having a different value. If someone can provide me guidance, I will really appreciate it. Thanks.



Edit: Was able to find a temporary solution utilizing:



wb = load_workbook("Workbook.xlsx")
ws = wb.active
sheet = wb["Sheet"]

for fila in ws.iter_rows('A2:A7'):
for celda in fila:
if celda.value != celda.offset(-1, 0).value:
print(celda.row)









share|improve this question





























    0















    Excel's column A has many rows with different values. Example:



    613
    613
    613
    625
    625
    631
    631...etc


    I want to iterate through column A and when the cell's value refers to a new value, obtain the cell's row.



    Expected result example:
    When the cell's value changed to 625, it will return the row 4. When 631, 6, and so on.



    This is my code so far:



    from openpyxl import Workbook, load_workbook

    wb = load_workbook("Workbook.xlsx")
    ws = wb.active
    sheet = wb["Visual Query2"]

    for row in ws.iter_rows(min_row=1, max_col=1, max_row=223181):
    for cell in row::
    print(cell.row)


    I got a bit lost when trying to catch when the cell starts having a different value. If someone can provide me guidance, I will really appreciate it. Thanks.



    Edit: Was able to find a temporary solution utilizing:



    wb = load_workbook("Workbook.xlsx")
    ws = wb.active
    sheet = wb["Sheet"]

    for fila in ws.iter_rows('A2:A7'):
    for celda in fila:
    if celda.value != celda.offset(-1, 0).value:
    print(celda.row)









    share|improve this question



























      0












      0








      0








      Excel's column A has many rows with different values. Example:



      613
      613
      613
      625
      625
      631
      631...etc


      I want to iterate through column A and when the cell's value refers to a new value, obtain the cell's row.



      Expected result example:
      When the cell's value changed to 625, it will return the row 4. When 631, 6, and so on.



      This is my code so far:



      from openpyxl import Workbook, load_workbook

      wb = load_workbook("Workbook.xlsx")
      ws = wb.active
      sheet = wb["Visual Query2"]

      for row in ws.iter_rows(min_row=1, max_col=1, max_row=223181):
      for cell in row::
      print(cell.row)


      I got a bit lost when trying to catch when the cell starts having a different value. If someone can provide me guidance, I will really appreciate it. Thanks.



      Edit: Was able to find a temporary solution utilizing:



      wb = load_workbook("Workbook.xlsx")
      ws = wb.active
      sheet = wb["Sheet"]

      for fila in ws.iter_rows('A2:A7'):
      for celda in fila:
      if celda.value != celda.offset(-1, 0).value:
      print(celda.row)









      share|improve this question
















      Excel's column A has many rows with different values. Example:



      613
      613
      613
      625
      625
      631
      631...etc


      I want to iterate through column A and when the cell's value refers to a new value, obtain the cell's row.



      Expected result example:
      When the cell's value changed to 625, it will return the row 4. When 631, 6, and so on.



      This is my code so far:



      from openpyxl import Workbook, load_workbook

      wb = load_workbook("Workbook.xlsx")
      ws = wb.active
      sheet = wb["Visual Query2"]

      for row in ws.iter_rows(min_row=1, max_col=1, max_row=223181):
      for cell in row::
      print(cell.row)


      I got a bit lost when trying to catch when the cell starts having a different value. If someone can provide me guidance, I will really appreciate it. Thanks.



      Edit: Was able to find a temporary solution utilizing:



      wb = load_workbook("Workbook.xlsx")
      ws = wb.active
      sheet = wb["Sheet"]

      for fila in ws.iter_rows('A2:A7'):
      for celda in fila:
      if celda.value != celda.offset(-1, 0).value:
      print(celda.row)






      python excel openpyxl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 3:05







      Patriots299

















      asked Jan 2 at 22:27









      Patriots299Patriots299

      16211




      16211
























          3 Answers
          3






          active

          oldest

          votes


















          1














          Perhaps the most straightforward approach is using zip, but this will require loading all the rows to memory and creating 2 lists, which may be tricky if you actually have 2 million rows:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          print([index + 1 for index, (a, b) in enumerate(zip(li[:-1], li[1:])) if a != b])
          # [2, 4, 6, 8, 9, 10, 11]


          A more conservative way will be to "cache" the last value:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          previous = None
          for index, n in enumerate(li):
          if previous is None:
          previous = n
          continue
          if previous != n:
          print(index)
          previous = n


          outputs



          2
          4
          6
          8
          9
          10
          11





          share|improve this answer
























          • It is a good approach. It does not really resolve the question because it does not implement OpenPyXl, but I have thumbed it up. I found an alternative that I have added as an edit. If you want to update your code, and it works, I will be marking your answer as the right one.

            – Patriots299
            Jan 3 at 3:04



















          1














          In order to keep track of when the value changed, you can use a variable to record the last value:



          def return_first_of_kind(iterable, key):
          previous_value = None
          for value in iterable:
          if key(value) != previous_value:
          yield value
          previous_value = key(value)


          The you use it as:



          def cell_a_value(row):
          return row[0].value

          for row in return_first_of_kind(ws.iter_rows(), key=cell_a_value):
          print(row)


          I forgot how to get the value of the first column from an openpyxl worksheet row, please update the cell_a_value function as needed.






          share|improve this answer
























          • It is a good approach, but does not entirely resolve the question. Therefore I have just thumbed your post up. If you want to edit, and it works well, I will mark your answer as the right one. For now, I have found a temporary solution that I have added as an edit.

            – Patriots299
            Jan 3 at 3:07



















          -2














          If you want to change as little as possible in your current code, I'd suggest storing the last value in some kind of temporary variable that you write over each time you move to the next row. You compare the current row's country code to the previous row's country code and, if they're different, you print the index of the row. If the index of the row isn't easily accessible, you can implement your own counter variable that tracks which index you're on. There may be more elegant solutions available, but these will work.



          Here's an example of the implementation I described above:



          i = 0
          temp = None
          for row in ws.iter_rows(min_row=1,max_col=1,max_row=223181):
          for cell in row:
          if cell.value != temp:
          print(i)
          temp = cell.value
          i += 1


          You may want to come up with a different way to assign the temporary variable the first time. This will print the first value no matter what.



          The highest upvoted solution here provides a more elegant solution for the issue of printing the index issue. Additionally, this documentation tells us there's a cleaner way of opening and reading the file (see the "Read-only" section).






          share|improve this answer


























          • Although I think the answer is technically correct a small code sample would make it way easier to understand.

            – Paulo Scardine
            Jan 3 at 0:33











          • I generally don't do that to prevent undergraduate copy-pasting ;). I also think it'd be more helpful for learners to have to implement it themselves. I can add that in though.

            – tkiral
            Jan 3 at 0:41











          • I appreciate you editing the post and providing more information. The problem with your code is that it will not differentiate whether there is a new value, but will only catch if the cell value is not blank.

            – Patriots299
            Jan 3 at 2:03











          • @FranJ Oops; I didn't include the temp update.....adding that in now. Based on the original explanation that was present, though, you'd know that this is updated through iteration and that I was missing that from my code

            – tkiral
            Jan 3 at 17:33














          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54013984%2fopenpyxl-looping-through-cells-until-condition%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Perhaps the most straightforward approach is using zip, but this will require loading all the rows to memory and creating 2 lists, which may be tricky if you actually have 2 million rows:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          print([index + 1 for index, (a, b) in enumerate(zip(li[:-1], li[1:])) if a != b])
          # [2, 4, 6, 8, 9, 10, 11]


          A more conservative way will be to "cache" the last value:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          previous = None
          for index, n in enumerate(li):
          if previous is None:
          previous = n
          continue
          if previous != n:
          print(index)
          previous = n


          outputs



          2
          4
          6
          8
          9
          10
          11





          share|improve this answer
























          • It is a good approach. It does not really resolve the question because it does not implement OpenPyXl, but I have thumbed it up. I found an alternative that I have added as an edit. If you want to update your code, and it works, I will be marking your answer as the right one.

            – Patriots299
            Jan 3 at 3:04
















          1














          Perhaps the most straightforward approach is using zip, but this will require loading all the rows to memory and creating 2 lists, which may be tricky if you actually have 2 million rows:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          print([index + 1 for index, (a, b) in enumerate(zip(li[:-1], li[1:])) if a != b])
          # [2, 4, 6, 8, 9, 10, 11]


          A more conservative way will be to "cache" the last value:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          previous = None
          for index, n in enumerate(li):
          if previous is None:
          previous = n
          continue
          if previous != n:
          print(index)
          previous = n


          outputs



          2
          4
          6
          8
          9
          10
          11





          share|improve this answer
























          • It is a good approach. It does not really resolve the question because it does not implement OpenPyXl, but I have thumbed it up. I found an alternative that I have added as an edit. If you want to update your code, and it works, I will be marking your answer as the right one.

            – Patriots299
            Jan 3 at 3:04














          1












          1








          1







          Perhaps the most straightforward approach is using zip, but this will require loading all the rows to memory and creating 2 lists, which may be tricky if you actually have 2 million rows:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          print([index + 1 for index, (a, b) in enumerate(zip(li[:-1], li[1:])) if a != b])
          # [2, 4, 6, 8, 9, 10, 11]


          A more conservative way will be to "cache" the last value:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          previous = None
          for index, n in enumerate(li):
          if previous is None:
          previous = n
          continue
          if previous != n:
          print(index)
          previous = n


          outputs



          2
          4
          6
          8
          9
          10
          11





          share|improve this answer













          Perhaps the most straightforward approach is using zip, but this will require loading all the rows to memory and creating 2 lists, which may be tricky if you actually have 2 million rows:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          print([index + 1 for index, (a, b) in enumerate(zip(li[:-1], li[1:])) if a != b])
          # [2, 4, 6, 8, 9, 10, 11]


          A more conservative way will be to "cache" the last value:



          li = [1, 1, 2, 2, 3, 3, 1, 1, 2, 1, 2, 3]
          previous = None
          for index, n in enumerate(li):
          if previous is None:
          previous = n
          continue
          if previous != n:
          print(index)
          previous = n


          outputs



          2
          4
          6
          8
          9
          10
          11






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 2 at 22:49









          DeepSpaceDeepSpace

          40.4k44778




          40.4k44778













          • It is a good approach. It does not really resolve the question because it does not implement OpenPyXl, but I have thumbed it up. I found an alternative that I have added as an edit. If you want to update your code, and it works, I will be marking your answer as the right one.

            – Patriots299
            Jan 3 at 3:04



















          • It is a good approach. It does not really resolve the question because it does not implement OpenPyXl, but I have thumbed it up. I found an alternative that I have added as an edit. If you want to update your code, and it works, I will be marking your answer as the right one.

            – Patriots299
            Jan 3 at 3:04

















          It is a good approach. It does not really resolve the question because it does not implement OpenPyXl, but I have thumbed it up. I found an alternative that I have added as an edit. If you want to update your code, and it works, I will be marking your answer as the right one.

          – Patriots299
          Jan 3 at 3:04





          It is a good approach. It does not really resolve the question because it does not implement OpenPyXl, but I have thumbed it up. I found an alternative that I have added as an edit. If you want to update your code, and it works, I will be marking your answer as the right one.

          – Patriots299
          Jan 3 at 3:04













          1














          In order to keep track of when the value changed, you can use a variable to record the last value:



          def return_first_of_kind(iterable, key):
          previous_value = None
          for value in iterable:
          if key(value) != previous_value:
          yield value
          previous_value = key(value)


          The you use it as:



          def cell_a_value(row):
          return row[0].value

          for row in return_first_of_kind(ws.iter_rows(), key=cell_a_value):
          print(row)


          I forgot how to get the value of the first column from an openpyxl worksheet row, please update the cell_a_value function as needed.






          share|improve this answer
























          • It is a good approach, but does not entirely resolve the question. Therefore I have just thumbed your post up. If you want to edit, and it works well, I will mark your answer as the right one. For now, I have found a temporary solution that I have added as an edit.

            – Patriots299
            Jan 3 at 3:07
















          1














          In order to keep track of when the value changed, you can use a variable to record the last value:



          def return_first_of_kind(iterable, key):
          previous_value = None
          for value in iterable:
          if key(value) != previous_value:
          yield value
          previous_value = key(value)


          The you use it as:



          def cell_a_value(row):
          return row[0].value

          for row in return_first_of_kind(ws.iter_rows(), key=cell_a_value):
          print(row)


          I forgot how to get the value of the first column from an openpyxl worksheet row, please update the cell_a_value function as needed.






          share|improve this answer
























          • It is a good approach, but does not entirely resolve the question. Therefore I have just thumbed your post up. If you want to edit, and it works well, I will mark your answer as the right one. For now, I have found a temporary solution that I have added as an edit.

            – Patriots299
            Jan 3 at 3:07














          1












          1








          1







          In order to keep track of when the value changed, you can use a variable to record the last value:



          def return_first_of_kind(iterable, key):
          previous_value = None
          for value in iterable:
          if key(value) != previous_value:
          yield value
          previous_value = key(value)


          The you use it as:



          def cell_a_value(row):
          return row[0].value

          for row in return_first_of_kind(ws.iter_rows(), key=cell_a_value):
          print(row)


          I forgot how to get the value of the first column from an openpyxl worksheet row, please update the cell_a_value function as needed.






          share|improve this answer













          In order to keep track of when the value changed, you can use a variable to record the last value:



          def return_first_of_kind(iterable, key):
          previous_value = None
          for value in iterable:
          if key(value) != previous_value:
          yield value
          previous_value = key(value)


          The you use it as:



          def cell_a_value(row):
          return row[0].value

          for row in return_first_of_kind(ws.iter_rows(), key=cell_a_value):
          print(row)


          I forgot how to get the value of the first column from an openpyxl worksheet row, please update the cell_a_value function as needed.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 1:33









          Paulo ScardinePaulo Scardine

          40.6k892118




          40.6k892118













          • It is a good approach, but does not entirely resolve the question. Therefore I have just thumbed your post up. If you want to edit, and it works well, I will mark your answer as the right one. For now, I have found a temporary solution that I have added as an edit.

            – Patriots299
            Jan 3 at 3:07



















          • It is a good approach, but does not entirely resolve the question. Therefore I have just thumbed your post up. If you want to edit, and it works well, I will mark your answer as the right one. For now, I have found a temporary solution that I have added as an edit.

            – Patriots299
            Jan 3 at 3:07

















          It is a good approach, but does not entirely resolve the question. Therefore I have just thumbed your post up. If you want to edit, and it works well, I will mark your answer as the right one. For now, I have found a temporary solution that I have added as an edit.

          – Patriots299
          Jan 3 at 3:07





          It is a good approach, but does not entirely resolve the question. Therefore I have just thumbed your post up. If you want to edit, and it works well, I will mark your answer as the right one. For now, I have found a temporary solution that I have added as an edit.

          – Patriots299
          Jan 3 at 3:07











          -2














          If you want to change as little as possible in your current code, I'd suggest storing the last value in some kind of temporary variable that you write over each time you move to the next row. You compare the current row's country code to the previous row's country code and, if they're different, you print the index of the row. If the index of the row isn't easily accessible, you can implement your own counter variable that tracks which index you're on. There may be more elegant solutions available, but these will work.



          Here's an example of the implementation I described above:



          i = 0
          temp = None
          for row in ws.iter_rows(min_row=1,max_col=1,max_row=223181):
          for cell in row:
          if cell.value != temp:
          print(i)
          temp = cell.value
          i += 1


          You may want to come up with a different way to assign the temporary variable the first time. This will print the first value no matter what.



          The highest upvoted solution here provides a more elegant solution for the issue of printing the index issue. Additionally, this documentation tells us there's a cleaner way of opening and reading the file (see the "Read-only" section).






          share|improve this answer


























          • Although I think the answer is technically correct a small code sample would make it way easier to understand.

            – Paulo Scardine
            Jan 3 at 0:33











          • I generally don't do that to prevent undergraduate copy-pasting ;). I also think it'd be more helpful for learners to have to implement it themselves. I can add that in though.

            – tkiral
            Jan 3 at 0:41











          • I appreciate you editing the post and providing more information. The problem with your code is that it will not differentiate whether there is a new value, but will only catch if the cell value is not blank.

            – Patriots299
            Jan 3 at 2:03











          • @FranJ Oops; I didn't include the temp update.....adding that in now. Based on the original explanation that was present, though, you'd know that this is updated through iteration and that I was missing that from my code

            – tkiral
            Jan 3 at 17:33


















          -2














          If you want to change as little as possible in your current code, I'd suggest storing the last value in some kind of temporary variable that you write over each time you move to the next row. You compare the current row's country code to the previous row's country code and, if they're different, you print the index of the row. If the index of the row isn't easily accessible, you can implement your own counter variable that tracks which index you're on. There may be more elegant solutions available, but these will work.



          Here's an example of the implementation I described above:



          i = 0
          temp = None
          for row in ws.iter_rows(min_row=1,max_col=1,max_row=223181):
          for cell in row:
          if cell.value != temp:
          print(i)
          temp = cell.value
          i += 1


          You may want to come up with a different way to assign the temporary variable the first time. This will print the first value no matter what.



          The highest upvoted solution here provides a more elegant solution for the issue of printing the index issue. Additionally, this documentation tells us there's a cleaner way of opening and reading the file (see the "Read-only" section).






          share|improve this answer


























          • Although I think the answer is technically correct a small code sample would make it way easier to understand.

            – Paulo Scardine
            Jan 3 at 0:33











          • I generally don't do that to prevent undergraduate copy-pasting ;). I also think it'd be more helpful for learners to have to implement it themselves. I can add that in though.

            – tkiral
            Jan 3 at 0:41











          • I appreciate you editing the post and providing more information. The problem with your code is that it will not differentiate whether there is a new value, but will only catch if the cell value is not blank.

            – Patriots299
            Jan 3 at 2:03











          • @FranJ Oops; I didn't include the temp update.....adding that in now. Based on the original explanation that was present, though, you'd know that this is updated through iteration and that I was missing that from my code

            – tkiral
            Jan 3 at 17:33
















          -2












          -2








          -2







          If you want to change as little as possible in your current code, I'd suggest storing the last value in some kind of temporary variable that you write over each time you move to the next row. You compare the current row's country code to the previous row's country code and, if they're different, you print the index of the row. If the index of the row isn't easily accessible, you can implement your own counter variable that tracks which index you're on. There may be more elegant solutions available, but these will work.



          Here's an example of the implementation I described above:



          i = 0
          temp = None
          for row in ws.iter_rows(min_row=1,max_col=1,max_row=223181):
          for cell in row:
          if cell.value != temp:
          print(i)
          temp = cell.value
          i += 1


          You may want to come up with a different way to assign the temporary variable the first time. This will print the first value no matter what.



          The highest upvoted solution here provides a more elegant solution for the issue of printing the index issue. Additionally, this documentation tells us there's a cleaner way of opening and reading the file (see the "Read-only" section).






          share|improve this answer















          If you want to change as little as possible in your current code, I'd suggest storing the last value in some kind of temporary variable that you write over each time you move to the next row. You compare the current row's country code to the previous row's country code and, if they're different, you print the index of the row. If the index of the row isn't easily accessible, you can implement your own counter variable that tracks which index you're on. There may be more elegant solutions available, but these will work.



          Here's an example of the implementation I described above:



          i = 0
          temp = None
          for row in ws.iter_rows(min_row=1,max_col=1,max_row=223181):
          for cell in row:
          if cell.value != temp:
          print(i)
          temp = cell.value
          i += 1


          You may want to come up with a different way to assign the temporary variable the first time. This will print the first value no matter what.



          The highest upvoted solution here provides a more elegant solution for the issue of printing the index issue. Additionally, this documentation tells us there's a cleaner way of opening and reading the file (see the "Read-only" section).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 3 at 17:33

























          answered Jan 2 at 22:33









          tkiraltkiral

          2419




          2419













          • Although I think the answer is technically correct a small code sample would make it way easier to understand.

            – Paulo Scardine
            Jan 3 at 0:33











          • I generally don't do that to prevent undergraduate copy-pasting ;). I also think it'd be more helpful for learners to have to implement it themselves. I can add that in though.

            – tkiral
            Jan 3 at 0:41











          • I appreciate you editing the post and providing more information. The problem with your code is that it will not differentiate whether there is a new value, but will only catch if the cell value is not blank.

            – Patriots299
            Jan 3 at 2:03











          • @FranJ Oops; I didn't include the temp update.....adding that in now. Based on the original explanation that was present, though, you'd know that this is updated through iteration and that I was missing that from my code

            – tkiral
            Jan 3 at 17:33





















          • Although I think the answer is technically correct a small code sample would make it way easier to understand.

            – Paulo Scardine
            Jan 3 at 0:33











          • I generally don't do that to prevent undergraduate copy-pasting ;). I also think it'd be more helpful for learners to have to implement it themselves. I can add that in though.

            – tkiral
            Jan 3 at 0:41











          • I appreciate you editing the post and providing more information. The problem with your code is that it will not differentiate whether there is a new value, but will only catch if the cell value is not blank.

            – Patriots299
            Jan 3 at 2:03











          • @FranJ Oops; I didn't include the temp update.....adding that in now. Based on the original explanation that was present, though, you'd know that this is updated through iteration and that I was missing that from my code

            – tkiral
            Jan 3 at 17:33



















          Although I think the answer is technically correct a small code sample would make it way easier to understand.

          – Paulo Scardine
          Jan 3 at 0:33





          Although I think the answer is technically correct a small code sample would make it way easier to understand.

          – Paulo Scardine
          Jan 3 at 0:33













          I generally don't do that to prevent undergraduate copy-pasting ;). I also think it'd be more helpful for learners to have to implement it themselves. I can add that in though.

          – tkiral
          Jan 3 at 0:41





          I generally don't do that to prevent undergraduate copy-pasting ;). I also think it'd be more helpful for learners to have to implement it themselves. I can add that in though.

          – tkiral
          Jan 3 at 0:41













          I appreciate you editing the post and providing more information. The problem with your code is that it will not differentiate whether there is a new value, but will only catch if the cell value is not blank.

          – Patriots299
          Jan 3 at 2:03





          I appreciate you editing the post and providing more information. The problem with your code is that it will not differentiate whether there is a new value, but will only catch if the cell value is not blank.

          – Patriots299
          Jan 3 at 2:03













          @FranJ Oops; I didn't include the temp update.....adding that in now. Based on the original explanation that was present, though, you'd know that this is updated through iteration and that I was missing that from my code

          – tkiral
          Jan 3 at 17:33







          @FranJ Oops; I didn't include the temp update.....adding that in now. Based on the original explanation that was present, though, you'd know that this is updated through iteration and that I was missing that from my code

          – tkiral
          Jan 3 at 17:33




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54013984%2fopenpyxl-looping-through-cells-until-condition%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith