0
votes

As I understood, there are no such functions: del, clear cache or garbage in openpyxl, maybe I am wrong. The problem I'm facing: The problem occurs when I want to save 2nd generated .xlsx file. It somehow uses previous .xlsx file (and it's data) and can't merge some cells (from prev xlsx) since it does not have a write attribute.

So how I can close/shutdown previous xlsx. I even tried remove xlsx file before generating new one and it also did not help!

code: (I dont have permission to post pics only links): pic 1:src(code, tree) how I am saving:

wb.save(filename=self.fileName)
wb.close()
  1. error

  2. class with id=1 xlsx

  3. class with id=4 xlsx, and my code some how wrote data from prev one(for ex: ECOLOGY 17:00-19:00) it should not work like that

  4. src code is here github

1
Please do not link out to images of code/errors but try to include as much as you can in the question itself - Michael S.
yep, sorry but stack says that I cant upload pic since i am newbie here ( I am so sad - oneku

1 Answers

0
votes

I'm not suprised that you can't reuse the same workbook object to save a file with another name. If you need to reuse this object, you can use workbook_obj.save(...);workbook_obj.close();workbook_obj=openpyxl.load_workbook(...). I haven't tested this code, but it's my best guess.