0

I am having trouble writing to an existing XLS file in python. Here is what I have so far:

import_data = xlrd.open_workbook('Example.xls', on_demand=True)

Edit data, create work book, save new data to worksheet and then...

wb.save('Example.xls')

Error:

Invalid argument: 'Example.xls'

If I change the file name in the save method, it works exactly as intended. Example:

wb.save('Example2.xls')

So it would appear that I am having an issue writing to a file that already exists. I searched for a way to 'close' Example.xls but from what I read it sounds like that isn't necessary?

Thanks!

Brian Breeden
  • 91
  • 1
  • 3
  • 8

1 Answers1

0

Try:

wb.release_resources()
# Edit your data.
wb.save('Example.xls')
wrivas
  • 509
  • 6
  • 12