Created
August 1, 2019 12:31
-
-
Save leovarmak/7ebba2c7783610441aa7ad623d893aa5 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
import xlrd | |
from xlrd.sheet import ctype_text | |
# Give the location of the file | |
loc = ("/home/karthikvarma/python/img.xlsx") | |
# To open | |
wb = xlrd.open_workbook(loc) | |
sheet = wb.sheet_by_index(0) | |
temp = sheet.nrows | |
tempagain = sheet.ncols | |
# print(temp) | |
# print(tempagain) | |
j = 0 | |
i = 0 | |
for l in range(temp): | |
row = sheet.row(l+1) | |
for idx, cell_obj in enumerate(row): | |
cell_type_str = ctype_text.get(cell_obj.ctype, 'unknown type') | |
if(cell_type_str != 'empty'): | |
totallength = (idx - (len(row) - 1)) * (-1) | |
j = totallength | |
print('j: %s' % (j)) | |
for l in range(tempagain): | |
gga = 1 | |
col = sheet.col(l+1) | |
for idx, cell_obj in enumerate(col): | |
cell_type_str = ctype_text.get(cell_obj.ctype, 'unknown type') | |
if(cell_type_str != 'empty'): | |
if(gga == 1): | |
gga = 0 | |
else: | |
totallength = idx -1 | |
i = totallength -1 | |
break | |
print('i: %s' % (i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment