# -*- coding: cp1251 -*- import pandas as pd ROWS_PER_FILE = 199 df = pd.read_excel('FILENAME.xlsx') ROWS_PER_FILE = 199 num_files = (len(df) // ROWS_PER_FILE) + (1 if len(df) % ROWS_PER_FILE > 0 else 0) for i in range(num_files): start_row = i * ROWS_PER_FILE end_row = start_row + ROWS_PER_FILE df_subset = df.iloc[start_row:end_row] output_filename = f'File_{i + 1}.xlsx' df_subset.to_excel(output_filename, index=False) print(f'Создано {num_files} файлов.')