본문 바로가기

파이썬/Pywin32

파이썬 엑셀 컨트롤, 워크북의 유용한 속성들, 이것만 알자!

반응형

여러분이 가장 많이 사용하는 워크북 속성(Workbook Attributes)들 중 자주 쓰는것들만 모아놓았습니다. 

# wb가 엑셀 워크북 객체라고 한다면, 

wb.Activate : 현재 워크북 활성화 시키기
wb.ActiveChart : 현재 워크북에서 활성화된 차트 객체 소환 
wb.ActiveSheet : 현재 워크북에서 활성화된 시트 객체 소환 
wb.AutoSaveOn : 자동저장 켜기/끄기 (True/False)
wb.Name : 현재 워크북 파일명 
wb.Path : 현재 파일 저장된 경로 소환 
wb.ReadOnly : 읽기전용 설정 (True/False)
wb.Save() : 저장
wb.SaveAs() : 다른이름으로 저장
wb.Sheets.Add() : 현재 워크북에 시트 추가 
wb.Worksheets : 현재 워크북에 포함된 워크시트 목록 (제너레이터 형식)
wb.Close() : 현재 워크북 닫기 (엑셀 프로세서는 종료하지 않고 파일만 닫음)
wb.NewWindow() : 현재 워크북 새창에서 다시 열기

 

저장 Save()이나 닫기 Close()는 항상 사용하고 나머지는 필요에 따라 적절히 쓰면 될 것 같네요. 

 

그 밖에 더 많은 속성들은 아래와 같습니다. 

반응형
# pywin32 워크북 객체 속성 모음
# 유용하게 사용하세요~! 

AcceptAllChanges
AcceptLabelsInFormulas
AccuracyVersion
Activate
ActiveChart
ActiveSheet
ActiveSlicer
AddRef
AddToFavorites
Application
ApplyTheme
Author
AutoSaveOn
AutoUpdateFrequency
AutoUpdateSaveChanges
BreakLink
BuiltinDocumentProperties
CalculationVersion
CanCheckIn
CaseSensitive
ChangeFileAccess
ChangeHistoryDuration
ChangeLink
ChartDataPointTrack
Charts
CheckCompatibility
CheckIn
CheckInWithVersion
Close
CodeName
Colors
CommandBars
Comments
ConflictResolution
Connections
ConnectionsDisabled
Container
ContentTypeProperties
ConvertComments
CreateBackup
CreateForecastSheet
Creator
CustomDocumentProperties
CustomViews
CustomXMLParts
Date1904
DefaultPivotTableStyle
DefaultSlicerStyle
DefaultTableStyle
DefaultTimelineStyle
DeleteNumberFormat
DialogSheets
DisplayDrawingObjects
DisplayInkComments
DoNotPromptForConvert
DocumentInspectors
DocumentLibraryVersions
Dummy16
Dummy17
Dummy26
Dummy27
EnableAutoRecover
EnableConnections
EncryptionProvider
EndReview
EnvelopeVisible
Excel4IntlMacroSheets
Excel4MacroSheets
Excel8CompatibilityMode
ExclusiveAccess
ExportAsFixedFormat
FileFormat
Final
FollowHyperlink
ForceFullCalculation
ForwardMailer
FullName
FullNameURLEncoded
GetIDsOfNames
GetTypeInfo
GetTypeInfoCount
GetWorkflowTasks
GetWorkflowTemplates
HTMLProject
HasMailer
HasPassword
HasRoutingSlip
HasVBProject
HighlightChangesOnScreen
HighlightChangesOptions
IconSets
InactiveListBorderVisible
Invoke
IsAddin
IsInplace
KeepChangeHistory
Keywords
LinkInfo
LinkSources
ListChangesOnNewSheet
LockServerFile
LookUpInDocs
Mailer
MergeWorkbook
Model
Modules
MultiUserEditing
Name
Names
NewWindow
OnSave
OnSheetActivate
OnSheetDeactivate
OpenLinks
Parent
Password
PasswordEncryptionAlgorithm
PasswordEncryptionFileProperties
PasswordEncryptionKeyLength
PasswordEncryptionProvider
Path
Permission
PersonalViewListSettings
PersonalViewPrintSettings
PivotCaches
PivotTableWizard
PivotTables
Post
PrecisionAsDisplayed
PrintOut
PrintPreview
Protect
ProtectSharing
ProtectStructure
ProtectWindows
PublishObjects
PublishToDocs
PublishToPBI
PurgeChangeHistoryNow
Queries
QueryInterface
ReadOnly
ReadOnlyRecommended
RecheckSmartTags
RefreshAll
RejectAllChanges
Release
ReloadAs
RemoveDocumentInformation
RemovePersonalInformation
RemoveUser
Reply
ReplyAll
ReplyWithChanges
Research
ResetColors
RevisionNumber
Route
Routed
RoutingSlip
RunAutoMacros
Save
SaveAs
SaveAsXMLData
SaveCopyAs
SaveLinkValues
Saved
SendFaxOverInternet
SendForReview
SendMail
SendMailer
SensitivityLabel
ServerPolicy
ServerViewableItems
SetLinkOnData
SetPasswordEncryptionOptions
SharedWorkspace
Sheets
ShowConflictHistory
ShowPivotChartActiveFields
ShowPivotTableFieldList
Signatures
SlicerCaches
SmartDocument
SmartTagOptions
Styles
Subject
Sync
TableStyles
TemplateRemoveExtData
Theme
Title
ToggleFormsDesign
Unprotect
UnprotectSharing
UpdateFromFile
UpdateLink
UpdateLinks
UpdateRemoteReferences
UseWholeCellCriteria
UseWildcards
UserControl
UserStatus
VBASigned
VBProject
WebOptions
WebPagePreview
Windows
WorkIdentity
Worksheets
WritePassword
WriteReserved
WriteReservedBy
XmlImport
XmlImportXml
XmlMaps
XmlNamespaces
_ApplyTypes_
_CodeName
_ExportAsFixedFormat
_FlagAsMethod
_LazyAddAttr_
_NewEnum
_PrintOut
_Protect
_ProtectSharing
_ReadOnlyRecommended
_Release_
_SaveAs
_UpdateWithITypeInfo_
__AttrToID__
__LazyMap__
__PrintOut
__SaveAs
__bool__
__call__
__class__
__delattr__
__dict__
__dir__
__doc__
__eq__
__format__
__ge__
__getattr__
__getattribute__
__getitem__
__gt__
__hash__
__init__
__init_subclass__
__int__
__le__
__len__
__lt__
__module__
__ne__
__new__
__reduce__
__reduce_ex__
__repr__
__setattr__
__setitem__
__sizeof__
__str__
__subclasshook__
__weakref__
_builtMethods_
_dir_ole_
_enum_
_find_dispatch_type_
_get_good_object_
_get_good_single_object_
_lazydata_
_make_method_
_mapCachedItems_
_oleobj_
_olerepr_
_print_details_
_proc_
_unicode_to_string_
_username_
_wrap_dispatch_
sblt

 

 

반응형