Marthee commited on
Commit
a1da098
·
verified ·
1 Parent(s): 4c14408

Update google_sheet_Legend.py

Browse files
Files changed (1) hide show
  1. google_sheet_Legend.py +20 -16
google_sheet_Legend.py CHANGED
@@ -131,16 +131,17 @@ def update_sheet(spreadsheetId, SimilarAreaDictionary, pdfpath):
131
  worksheet.cell((2, 11)).value = 'Comments'
132
  second_row_data = ['Nr', 'm2', 'Total', 'm', 'Total', 'm', 'Total']
133
  worksheet.update_row(3, second_row_data, col_offset=2)
134
- worksheet.update_col(1, list(SimilarAreaDictionary['Guess']), row_offset=3)
135
- worksheet.update_col(3, list(SimilarAreaDictionary['Occurences']), row_offset=3)
136
- worksheet.update_col(4, list(SimilarAreaDictionary['Area']), row_offset=3)
137
- worksheet.update_col(5, list(SimilarAreaDictionary['Total Area']), row_offset=3)
138
- worksheet.update_col(6, list(SimilarAreaDictionary['Perimeter']), row_offset=3)
139
- worksheet.update_col(7, list(SimilarAreaDictionary['Total Perimeter']), row_offset=3)
140
- worksheet.update_col(8, list(SimilarAreaDictionary['Length']), row_offset=3)
141
- worksheet.update_col(9, list(SimilarAreaDictionary['Total Length']), row_offset=3)
142
- worksheet.update_col(10, list(SimilarAreaDictionary['Texts']), row_offset=3)
143
- worksheet.update_col(11, list(SimilarAreaDictionary['Comments']), row_offset=3)
 
144
 
145
  if splittedpdfpath[-2].startswith('1.0'):
146
  colorsUsed = [
@@ -963,9 +964,12 @@ def getallguessednames():
963
  # Retrieve column data from the worksheet
964
  global worksheetw
965
  guessednames = worksheetw.get_col(1, returnas='matrix', include_tailing_empty=False)
966
- # Skip the first three entries and filter out empty/whitespace strings
967
- for item in guessednames[3:]:
968
- if item.strip() and item not in guessednamesfinal: # Remove surrounding whitespace and check for uniqueness
969
- guessednamesfinal.append(item)
970
- print('guessednamesfinal:', guessednamesfinal)
971
- return guessednamesfinal
 
 
 
 
131
  worksheet.cell((2, 11)).value = 'Comments'
132
  second_row_data = ['Nr', 'm2', 'Total', 'm', 'Total', 'm', 'Total']
133
  worksheet.update_row(3, second_row_data, col_offset=2)
134
+ if len(list(SimilarAreaDictionary['Guess']))>0:
135
+ worksheet.update_col(1, list(SimilarAreaDictionary['Guess']), row_offset=3)
136
+ worksheet.update_col(3, list(SimilarAreaDictionary['Occurences']), row_offset=3)
137
+ worksheet.update_col(4, list(SimilarAreaDictionary['Area']), row_offset=3)
138
+ worksheet.update_col(5, list(SimilarAreaDictionary['Total Area']), row_offset=3)
139
+ worksheet.update_col(6, list(SimilarAreaDictionary['Perimeter']), row_offset=3)
140
+ worksheet.update_col(7, list(SimilarAreaDictionary['Total Perimeter']), row_offset=3)
141
+ worksheet.update_col(8, list(SimilarAreaDictionary['Length']), row_offset=3)
142
+ worksheet.update_col(9, list(SimilarAreaDictionary['Total Length']), row_offset=3)
143
+ worksheet.update_col(10, list(SimilarAreaDictionary['Texts']), row_offset=3)
144
+ worksheet.update_col(11, list(SimilarAreaDictionary['Comments']), row_offset=3)
145
 
146
  if splittedpdfpath[-2].startswith('1.0'):
147
  colorsUsed = [
 
964
  # Retrieve column data from the worksheet
965
  global worksheetw
966
  guessednames = worksheetw.get_col(1, returnas='matrix', include_tailing_empty=False)
967
+ if len(guessednames[3:])>0:
968
+ # Skip the first three entries and filter out empty/whitespace strings
969
+ for item in guessednames[3:]:
970
+ if item.strip() and item not in guessednamesfinal: # Remove surrounding whitespace and check for uniqueness
971
+ guessednamesfinal.append(item)
972
+ print('guessednamesfinal:', guessednamesfinal)
973
+ return guessednamesfinal
974
+ else:
975
+ return 'None'