January 2000
Intermediate to advanced
672 pages
21h 46m
English
Both Python and Excel support keyword arguments. These are generally used when you have a long list of possible arguments to a function, most of which have default values. Excel takes this to extremes; for example, the function to save a workbook is:
WorkBook.SaveAs(Filename,FileFormat,Password,WriteResPassword,ReadOnlyRecommended,CreateBackup,AddToMru,TextCodePage,TextVisualLayout)
And that’s a short one: some of the formatting commands have literally dozens of arguments. To call these, you supply only the arguments you want, as follows:
>>> xlBook.SaveAs(Filename='C:\\temp\\mysheet.xls') >>>
The capitalization of the keywords must be exactly right. Microsoft
generally uses mixed case for everything but
Filename, but you’ll undoubtedly have a fun
time discovering more exceptions.
Read now
Unlock full access