Python Forum
openpyxl incorrect delete rows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
openpyxl incorrect delete rows
#1
When I delete lines through openpyxl, they are not deleted correctly. In some places they even stay. Need to delete rows completely, as excel does. Thank you.

import openpyxl

this_book = openpyxl.open( "example.xlsx" )
this_book.active = 1

def result_i():
    return 10

i = result_i()

if i < 255:
    this_book.active.delete_rows(i, 255-i)

this_book.save("result.xlsx")
this_book.close()
[Image: aVyPZ.png]

Example:
https://drive.google.com/file/d/1KINvDVn...sp=sharing
Reply


Messages In This Thread
openpyxl incorrect delete rows - by VladislavM - Jul-18-2021, 12:24 PM
RE: openpyxl incorrect delete rows - by buran - Jul-18-2021, 03:20 PM
RE: openpyxl incorrect delete rows - by VladislavM - Jul-18-2021, 06:55 PM
RE: openpyxl incorrect delete rows - by buran - Jul-18-2021, 08:23 PM
RE: openpyxl incorrect delete rows - by VladislavM - Jul-18-2021, 08:36 PM
RE: openpyxl incorrect delete rows - by buran - Jul-19-2021, 05:19 AM
RE: openpyxl incorrect delete rows - by VladislavM - Jul-19-2021, 08:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Code is returning the incorrect values. syntax error 007sonic 6 1,401 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  Pymysql delete specific rows in tableview stsxbel 2 1,138 Aug-18-2022, 09:50 AM
Last Post: ibreeden
  error 1102 (42000) incorrect database name 's' Anldra12 4 1,788 Jun-08-2022, 09:00 AM
Last Post: Anldra12
  Trying to delete rows above a specific datetime value cubangt 19 12,205 May-09-2022, 08:57 PM
Last Post: deanhystad
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,679 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983
  Incorrect Type Error milkycow 4 3,023 Jun-25-2021, 06:04 AM
Last Post: milkycow
  Pandas DataFrame combine rows by column value, where Date Rows are NULL rhat398 0 2,179 May-04-2021, 10:51 PM
Last Post: rhat398
  Indexing [::-1] to Reverse ALL 2D Array Rows, ALL 3D, 4D Array Columns & Rows Python Jeremy7 8 7,441 Mar-02-2021, 01:54 AM
Last Post: Jeremy7
  Why is 0.1 * 0.2 arithmetically incorrect? Pedroski55 2 2,297 Nov-25-2020, 12:01 AM
Last Post: snippsat
  my openpyxl use is too slow, am I reading rows incorrectly? Clunk_Head 2 8,462 Apr-30-2020, 10:29 PM
Last Post: deac33

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020