Last active
March 5, 2017 13:17
-
-
Save kerbrose/91e2d98161f8163ec115efd9bbd7777b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openpyxl import load_workbook | |
target_directories = [file_names] | |
for wb_loc in target_directories: | |
print(wb_loc, " : ", " : ", " : ") | |
wb = load_workbook(wb_loc, read_only = True) | |
for sheet in wb: | |
print("SHEET TITLE", " : ", sheet.title, " : ", "SHEET MAX ROWS", " : ", sheet.max_row) | |
for index, current_row in enumerate(sheet.iter_rows()): | |
for current_cell in current_row: | |
if current_cell.value == 'بـنـود الاعــمــا ل': | |
starting_row = index | |
print("STARTING INDEX", " : ", starting_row, " : ", " : ") | |
print("ENUMERATOR LENGTH", " : ",len(list(enumerate(sheet.iter_rows(min_row = starting_row)))), " : ", " : ") | |
neighbour_cell = sheet.cell(row=current_cell.row, column=current_cell.column + 1 ) | |
print(current_cell.coordinate , " : ", current_cell.value, " : ", neighbour_cell.coordinate , " : ", neighbour_cell.value ) | |
for index_2, row in enumerate(sheet.iter_rows(min_row = starting_row)): | |
material = sheet.cell(row=current_cell.row + index_2 + 1, column=current_cell.column) | |
material_uom = sheet.cell(row=neighbour_cell.row + index_2 + 1, column=neighbour_cell.column) | |
if material.value: | |
print ( material.coordinate, " : ", material.value, " : ", material_uom.coordinate, " : ", material_uom.value) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment