21 lines
647 B
Python
21 lines
647 B
Python
import xlrd
|
|
|
|
file_path = r"C:\workspace\njts-accounting-core\reports\tmp\01-07 (3).xls"
|
|
workbook = xlrd.open_workbook(file_path)
|
|
sheet = workbook.sheet_by_index(0)
|
|
|
|
print(f"シート名: {sheet.name}")
|
|
print(f"行数: {sheet.nrows}, 列数: {sheet.ncols}")
|
|
print("\n最初の15行:")
|
|
print("=" * 100)
|
|
|
|
for row_idx in range(min(15, sheet.nrows)):
|
|
row_values = []
|
|
for col_idx in range(min(15, sheet.ncols)):
|
|
cell_value = sheet.cell_value(row_idx, col_idx)
|
|
if cell_value == '':
|
|
row_values.append('')
|
|
else:
|
|
row_values.append(str(cell_value))
|
|
print(f"行{row_idx}: {' | '.join(row_values)}")
|