On Mar 10, 9:30 pm, ATDI_Ade <
adrian.gra...@atdi.co.uk> wrote:
> Hi just joined group, sorry if this question has been asked before.
Welcome, Adrian.
> How do I rename an excel worksheet in excel?
In Excel? You right-click on the sheet name tab at the bottom of the
window, select Rename from the pop-up menu, edit the name, press the
Enter key.
> The sheets.py functionality does not include a rename attribute.
What is "sheets.py"?
> Any ideas?
To change the contents of an Excel workbook using Python, there are
two main possibilities:
(1) Use the pywin32 module. The basic idea is that you get a
connection to an Excel process, open the file, make changes, save the
file. The HOWTO is in a book: google("Python win32 Hammond
Robinson").
(2) Read file into memory using xlrd (ReadD) module. Use xlwt (WriTe)
module to create an empty workbook object. Copy data from xlrd objects
to xlwt objects, doing add/change/delete as you go. Save xlwt workbook
object to file. Needs neither Excel nor Windows. Copies only data and
basic formatting; omits most of the esoteric features.
Which you use is likely to depend on your environment and what else if
anything you want to do to/with Excel files other than renaming
worksheets.
Cheers,
John