2014-04-16 7 views
1

한 통합 문서에서 다른 통합 문서로 시트를 복사하려고합니다.하지만 통합 문서에이 시트의 이전 버전이 이미있을 수 있기 때문에 먼저 복사 한 내용이 있는지 먼저 확인하고 복사하기 전에 먼저 삭제하려고합니다. . 그러나 remove_sheet를 실행할 때 오류가 계속 발생합니다 (시트가 제거됨). 어떤 아이디어? (파일에있는 유일한 시트가 아니므로 그 문제는 아닙니다.)Datanitro의 remove_sheet가 예외를 throw합니다

def import_sheet(book_from, book_to ,sheet_to_cpy): 
      active_wkbk(book_to) 
      if sheet_to_cpy in all_sheets(True): 
        remove_sheet(sheet_to_cpy)  
      active_wkbk(book_from) 
      copy_sheet(book_to, sheet_to_cpy) 


    File "blah.py", line 22, in import_sheet 
    remove_sheet(sheet_to_cpy) 
    File "27/basic_io.py", line 1348, in remove_sheet 
    File "27/basic_io.py", line 1215, in active_sheet 
NameError: MyTab is not an existing worksheet 

답변

2

이것은 우리가 할 수있는 한 빨리 버그를 수정합니다!

def import_sheet(book_from, book_to, sheet_to_cpy): 
    active_wkbk(book_to) 
    if sheet_to_cpy in all_sheets(True): 
     if sheet_to_cpy == active_sheet(): 
      ## avoid bug by manually setting last sheet active 
      active_sheet(all_sheets()[-1]) 
     remove_sheet(sheet_to_cpy)  
    active_wkbk(book_from) 
    copy_sheet(book_to, sheet_to_cpy) 

출처 : : 한편

, 여기에 해결의 나는 DataNitro 개발자 중 하나입니다.

관련 문제