0

I need to update values in an existing excel file.

I need to open an existing file. I need to update for example the cell value in row 4 column A. I need to close and save the existing file.

I have tried a simple code but it returns an error.

CHECK MY CODE

EDIT: the code from the image works and executes but when i open the Excel file excel returns an error.

Dhristov
  • 1
  • 2
  • what does copy method does in your code ? is it copy module ? – PurushothamC Sep 18 '19 at 17:07
  • https://stackoverflow.com/questions/2725852/writing-to-existing-workbook-using-xlwt may be useful. My own experiences were with .xls files so that may not be helpful - when working with those it was only possible if your input file was simple enough, because some formatting information got lost between opening the input file and creating a writeable version. But the .xslx format is different enough that that may not hold. – Peter DeGlopper Sep 18 '19 at 17:11
  • I don't know actually. I followed a tutorial which included it. – Dhristov Sep 18 '19 at 17:14

1 Answers1

1

workable_copy = copy(read_excel)

TypeError: 'module' object is not callable

This message means that you're calling a module as though it were a function. Since your script recognizes copy as a module, I assume you've imported it with import xlutils.copy. However, if you want to use the function without qualifying it, you have to import it like this:

from xlutils.copy import copy
Community
  • 1
  • 1
Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880