File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -264,11 +264,8 @@ def _create_pivot_chart(
264264
265265 xl_chart_type = xl_chart_types [chart_type_lower ]
266266
267- # Check if file is open in Excel
268- is_blocked , error_msg = _check_file_not_open_in_excel (path )
269- if is_blocked :
270- typer .secho (f"Error: { error_msg } " , fg = typer .colors .RED , err = True )
271- raise typer .Exit (code = int (ErrorCode .FILE_IN_USE ))
267+ # Note: We don't check for file open in Excel here because win32com's
268+ # Dispatch("Excel.Application") can connect to an already-open instance
272269
273270 excel = None
274271 try :
Original file line number Diff line number Diff line change @@ -176,11 +176,8 @@ def create(
176176 )
177177 raise typer .Exit (code = int (ErrorCode .FILE_DOES_NOT_EXIST ))
178178
179- # Check if file is open in Excel
180- is_blocked , error_msg = _check_file_not_open_in_excel (path )
181- if is_blocked :
182- typer .secho (f"Error: { error_msg } " , fg = typer .colors .RED , err = True )
183- raise typer .Exit (code = int (ErrorCode .FILE_IN_USE ))
179+ # Note: We don't check for file open in Excel here because win32com's
180+ # Dispatch("Excel.Application") can connect to an already-open instance
184181
185182 # Determine target sheet
186183 target_sheet = sheet if sheet else f"{ source_sheet } _Pivot"
@@ -553,11 +550,8 @@ def refresh(
553550 )
554551 raise typer .Exit (code = int (ErrorCode .FILE_DOES_NOT_EXIST ))
555552
556- # Check if file is open in Excel
557- is_blocked , error_msg = _check_file_not_open_in_excel (path )
558- if is_blocked :
559- typer .secho (f"Error: { error_msg } " , fg = typer .colors .RED , err = True )
560- raise typer .Exit (code = int (ErrorCode .FILE_IN_USE ))
553+ # Note: We don't check for file open in Excel here because win32com's
554+ # Dispatch("Excel.Application") can connect to an already-open instance
561555
562556 excel = None
563557 try :
Original file line number Diff line number Diff line change 1515from openpyxl .worksheet .table import Table
1616
1717from xlforge .core .errors import ErrorCode
18- from xlforge .core .utils import _check_file_not_open_in_excel
1918
2019table_app = typer .Typer (help = "Table operations for Excel workbooks." )
2120
@@ -121,11 +120,8 @@ def _create_native_table(
121120 )
122121 raise typer .Exit (code = int (ErrorCode .FEATURE_UNAVAILABLE ))
123122
124- # Check if file is open in Excel
125- is_blocked , error_msg = _check_file_not_open_in_excel (path )
126- if is_blocked :
127- typer .secho (f"Error: { error_msg } " , fg = typer .colors .RED , err = True )
128- raise typer .Exit (code = int (ErrorCode .FILE_IN_USE ))
123+ # Note: We don't check for file open in Excel here because win32com's
124+ # Dispatch("Excel.Application") can connect to an already-open instance
129125
130126 excel = None
131127 try :
You can’t perform that action at this time.
0 commit comments