Spaces:
Sleeping
Sleeping
Update google_sheet_Legend.py
Browse files- google_sheet_Legend.py +97 -591
google_sheet_Legend.py
CHANGED
|
@@ -59,6 +59,10 @@ def update_sheet(spreadsheetId, SimilarAreaDictionary, pdfpath):
|
|
| 59 |
splittedpdfpath = re.split(r'[`\-=~!@#$%^&*()_+\[\]{};\'\\:"|<,/<>?]', pdfpath)
|
| 60 |
if splittedpdfpath[-2].startswith('2.2') or splittedpdfpath[-2].startswith('2.1'):
|
| 61 |
worksheet.set_dataframe(start='A1', df=SimilarAreaDictionary)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
else:
|
| 63 |
top_header_format = [
|
| 64 |
{'mergeCells': { # areas
|
|
@@ -628,596 +632,98 @@ def deletefromlegend(deletedrows,SimilarAreaDictionarycopy,section, areaPermArr=
|
|
| 628 |
SimilarAreaDictionarycopy.loc[idx,'Total Perimeter'] = SimilarAreaDictionarycopy.loc[idx,'Total Perimeter'] - perimstodelete[i]
|
| 629 |
return SimilarAreaDictionarycopy
|
| 630 |
|
| 631 |
-
######################
|
| 632 |
-
######################
|
| 633 |
-
# # -*- coding: utf-8 -*-
|
| 634 |
-
# """Google Sheet to XML.ipynb
|
| 635 |
-
|
| 636 |
-
# Automatically generated by Colaboratory.
|
| 637 |
-
|
| 638 |
-
# Original file is located at
|
| 639 |
-
# https://colab.research.google.com/drive/1T-b1N8Gq6wwbBurODzJIdhRQNeRbyBnz
|
| 640 |
-
# """
|
| 641 |
-
|
| 642 |
-
# from googleapiclient.discovery import build
|
| 643 |
-
# from google.oauth2 import service_account
|
| 644 |
-
# import pygsheets
|
| 645 |
-
# import ast
|
| 646 |
-
# import re
|
| 647 |
-
# import pandas as pd
|
| 648 |
-
|
| 649 |
-
# def authorizeLegend():
|
| 650 |
-
# SCOPES = [
|
| 651 |
-
# 'https://www.googleapis.com/auth/spreadsheets',
|
| 652 |
-
# 'https://www.googleapis.com/auth/drive',
|
| 653 |
-
# 'https://www.googleapis.com/auth/drive.metadata'
|
| 654 |
-
# ]
|
| 655 |
-
# credentials = service_account.Credentials.from_service_account_file('credentials.json', scopes=SCOPES)
|
| 656 |
-
# spreadsheet_service = build('sheets', 'v4', credentials=credentials)
|
| 657 |
-
# drive_service = build('drive', 'v3', credentials=credentials)
|
| 658 |
-
# gc = pygsheets.authorize(custom_credentials=credentials, client_secret='credentials.json')
|
| 659 |
-
# return spreadsheet_service,drive_service,gc
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
# def legendGoogleSheets(SimilarAreaDictionary,path ,pdfpath, spreadsheetId=0):
|
| 663 |
-
|
| 664 |
-
# spreadsheet_service,drive_service,gc=authorizeLegend()
|
| 665 |
-
# ########
|
| 666 |
-
# legendTitle= path
|
| 667 |
-
# titles=gc.spreadsheet_titles()
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
# if legendTitle in titles:
|
| 672 |
-
# print('found sheet ', legendTitle)
|
| 673 |
-
# ws=gc.open(str(legendTitle))
|
| 674 |
-
# spreadsheetId=ws.id
|
| 675 |
-
# else:
|
| 676 |
-
# # ####### create new sheet
|
| 677 |
-
# print('creating new sheeet')
|
| 678 |
-
|
| 679 |
-
# spreadsheet_details = {
|
| 680 |
-
# 'properties': {
|
| 681 |
-
# 'title': path
|
| 682 |
-
# }
|
| 683 |
-
# }
|
| 684 |
-
# sheet = spreadsheet_service.spreadsheets().create(body=spreadsheet_details,
|
| 685 |
-
# fields='spreadsheetId').execute()
|
| 686 |
-
|
| 687 |
-
# spreadsheetId = sheet.get('spreadsheetId')
|
| 688 |
-
# permission1 = {
|
| 689 |
-
# 'type': 'anyone',
|
| 690 |
-
# 'role': 'writer',
|
| 691 |
-
# # 'emailAddress': 'marthe.adr@gmail.com'
|
| 692 |
-
# }
|
| 693 |
-
# # permission2 = {
|
| 694 |
-
# # 'type': 'user',
|
| 695 |
-
# # 'role': 'writer',
|
| 696 |
-
# # 'emailAddress': 'marthe.adr@gmail.com',
|
| 697 |
-
# # 'pendingOwner': True
|
| 698 |
-
# # }
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
# drive_service.permissions().create(fileId=spreadsheetId, body=permission1, supportsAllDrives=True ).execute()
|
| 702 |
-
# ws=gc.open_by_key(spreadsheetId)
|
| 703 |
-
|
| 704 |
-
# sheetId = '0' # Please set sheet ID.
|
| 705 |
-
# worksheet = ws.worksheet(0)
|
| 706 |
-
# worksheet.title='Legend and data created'
|
| 707 |
-
# worksheet.clear()
|
| 708 |
-
# print('PDFPATHHH',pdfpath)
|
| 709 |
-
# ws.create_developer_metadata('path',pdfpath)
|
| 710 |
-
# splittedpdfpath=re.split(r'[`\-=~!@#$%^&*()_+\[\]{};\'\\:"|<,/<>?]', pdfpath)
|
| 711 |
-
# namepathArr=[legendTitle , spreadsheetId,ws.get_developer_metadata('path')[0].value]
|
| 712 |
-
# if splittedpdfpath[-2].startswith('2.2') or splittedpdfpath[-2].startswith('2.1') :
|
| 713 |
-
# worksheet.set_dataframe(start='A1',df=SimilarAreaDictionary)
|
| 714 |
-
# print(SimilarAreaDictionary)
|
| 715 |
-
# else:
|
| 716 |
-
# top_header_format = [
|
| 717 |
-
# {'mergeCells': { #areas
|
| 718 |
-
# 'mergeType': 'MERGE_ROWS',
|
| 719 |
-
# 'range': {
|
| 720 |
-
# 'sheetId': '0',
|
| 721 |
-
# 'startRowIndex': 1,
|
| 722 |
-
# 'endRowIndex': 2,
|
| 723 |
-
# 'startColumnIndex': 3,
|
| 724 |
-
# 'endColumnIndex':5
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
# }
|
| 728 |
-
# }},
|
| 729 |
-
|
| 730 |
-
# {'mergeCells': { #perimeters
|
| 731 |
-
# 'mergeType': 'MERGE_ROWS',
|
| 732 |
-
# 'range': {
|
| 733 |
-
# 'sheetId': '0',
|
| 734 |
-
# 'startRowIndex': 1,
|
| 735 |
-
# 'endRowIndex': 2,
|
| 736 |
-
# 'startColumnIndex': 5,
|
| 737 |
-
# 'endColumnIndex':7
|
| 738 |
-
# }
|
| 739 |
-
|
| 740 |
-
# }},
|
| 741 |
-
# {'mergeCells': { #lengths
|
| 742 |
-
# 'mergeType': 'MERGE_ROWS',
|
| 743 |
-
# 'range': {
|
| 744 |
-
# 'sheetId': '0',
|
| 745 |
-
# 'startRowIndex': 1,
|
| 746 |
-
# 'endRowIndex': 2,
|
| 747 |
-
# 'startColumnIndex': 7,
|
| 748 |
-
# 'endColumnIndex':9
|
| 749 |
-
# }
|
| 750 |
-
|
| 751 |
-
# }},
|
| 752 |
-
|
| 753 |
-
# {'mergeCells': { # legend and data created
|
| 754 |
-
# 'mergeType': 'MERGE_ROWS',
|
| 755 |
-
# 'range': {
|
| 756 |
-
# 'sheetId': '0',
|
| 757 |
-
# 'startRowIndex': 0,
|
| 758 |
-
# 'endRowIndex': 1,
|
| 759 |
-
# 'startColumnIndex': 0,
|
| 760 |
-
# 'endColumnIndex':10
|
| 761 |
-
# }
|
| 762 |
-
|
| 763 |
-
# }}
|
| 764 |
-
# ]
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
# spreadsheet_service.spreadsheets().batchUpdate( spreadsheetId=spreadsheetId , body={'requests': top_header_format} ).execute()
|
| 768 |
-
# worksheet.cell((1,1)).value='Legend and Data Created'
|
| 769 |
-
# worksheet.cell((2,1)).value='Guess'
|
| 770 |
-
# worksheet.cell((2,2)).value='Color'
|
| 771 |
-
# worksheet.cell((2,3)).value='Count'
|
| 772 |
-
# worksheet.cell((2,4)).value='Areas'
|
| 773 |
-
# worksheet.cell((2,6)).value='Perimeters'
|
| 774 |
-
# worksheet.cell((2,8)).value='Lengths'
|
| 775 |
-
# worksheet.cell((2,10)).value='Texts'
|
| 776 |
-
# second_row_data=['Nr','m2','Total','m','Total','m','Total']
|
| 777 |
-
# if splittedpdfpath[-2].startswith('1.0') or splittedpdfpath[-2].startswith('3.2'):
|
| 778 |
-
# worksheet.update_row(3,second_row_data,col_offset=2)
|
| 779 |
-
# worksheet.update_col(1,list(SimilarAreaDictionary['Guess']),row_offset=3)
|
| 780 |
-
# worksheet.update_col(3,list(SimilarAreaDictionary['Occurences']),row_offset=3)
|
| 781 |
-
# worksheet.update_col(4,list(SimilarAreaDictionary['Area']),row_offset=3)
|
| 782 |
-
# worksheet.update_col(5,list(SimilarAreaDictionary['Total Area']),row_offset=3)
|
| 783 |
-
# worksheet.update_col(6,list(SimilarAreaDictionary['Perimeter']),row_offset=3)
|
| 784 |
-
# worksheet.update_col(7,list(SimilarAreaDictionary['Total Perimeter']),row_offset=3)
|
| 785 |
-
|
| 786 |
-
# worksheet.update_col(8,list(SimilarAreaDictionary['Length']),row_offset=3)
|
| 787 |
-
# worksheet.update_col(9,list(SimilarAreaDictionary['Total Length']),row_offset=3)
|
| 788 |
-
# worksheet.update_col(10,list(SimilarAreaDictionary['Texts']),row_offset=3)
|
| 789 |
-
# if splittedpdfpath[-2].startswith('1.0'):
|
| 790 |
-
# colorsUsed=[]
|
| 791 |
-
# for i in range(len(SimilarAreaDictionary)):
|
| 792 |
-
# colorsUsed.append([SimilarAreaDictionary['R'].iloc[i] ,SimilarAreaDictionary['G'].iloc[i] , SimilarAreaDictionary['B'].iloc[i]] )
|
| 793 |
-
# elif splittedpdfpath[-2].startswith('3.2'):
|
| 794 |
-
# colorsUsed=list(SimilarAreaDictionary['Color'])
|
| 795 |
-
|
| 796 |
-
# #legend specs here
|
| 797 |
-
# rowsLen=len(SimilarAreaDictionary.values.tolist()) #kam row -- last row = rowsLen +1
|
| 798 |
-
# lastcell=worksheet.cell((rowsLen+2,1)) #row,col
|
| 799 |
-
# lastcellNotation=str(lastcell.address.label)
|
| 800 |
-
# # worksheet.set_data_validation('A3',lastcellNotation, condition_type='ONE_OF_LIST', condition_values=['Ground Beam','Pile Cap'], showCustomUi=True)
|
| 801 |
-
|
| 802 |
-
# #get lengths of df
|
| 803 |
-
# columnsLen=len(SimilarAreaDictionary.columns.values.tolist()) #kam column -- last col = columnsLen+1 3shan base0
|
| 804 |
-
# lastUsedCol=columnsLen+1
|
| 805 |
-
|
| 806 |
-
# worksheet.adjust_column_width(start=2,end=3)
|
| 807 |
-
# worksheet.adjust_column_width(start=10,end=10)
|
| 808 |
-
# # if splittedpdfpath[-2].startswith('1.0'):
|
| 809 |
-
# worksheet.adjust_column_width(start=4,end=9,pixel_size=60)
|
| 810 |
-
# startrow = 3
|
| 811 |
-
# # elif splittedpdfpath[-2].startswith('3.2'):
|
| 812 |
-
# # startrow=2
|
| 813 |
-
|
| 814 |
-
# sheetId = '0' # Please set sheet ID.
|
| 815 |
-
# for i in range(len(colorsUsed)):
|
| 816 |
-
|
| 817 |
-
# print(colorsUsed[i])
|
| 818 |
-
# r,g,b=colorsUsed[i]
|
| 819 |
-
# body = {
|
| 820 |
-
# "requests": [
|
| 821 |
-
# {
|
| 822 |
-
# "updateCells": {
|
| 823 |
-
# "range": {
|
| 824 |
-
# "sheetId": sheetId,
|
| 825 |
-
# "startRowIndex": i+startrow,
|
| 826 |
-
# # "endRowIndex":4 ,
|
| 827 |
-
# "startColumnIndex":1,
|
| 828 |
-
|
| 829 |
-
# # "endColumnIndex": 0
|
| 830 |
-
# },
|
| 831 |
-
|
| 832 |
-
# "rows": [
|
| 833 |
-
# {
|
| 834 |
-
# "values": [
|
| 835 |
-
# {
|
| 836 |
-
# "userEnteredFormat": {
|
| 837 |
-
# "backgroundColor": {
|
| 838 |
-
|
| 839 |
-
# "red": r/255,
|
| 840 |
-
# "green": g/255,
|
| 841 |
-
# "blue": b/255,
|
| 842 |
-
# "alpha": 0.4,
|
| 843 |
-
|
| 844 |
-
# }
|
| 845 |
-
|
| 846 |
-
# }
|
| 847 |
-
# }
|
| 848 |
-
# ]
|
| 849 |
-
# }
|
| 850 |
-
# ],
|
| 851 |
-
# "fields": "userEnteredFormat.backgroundColor",
|
| 852 |
-
|
| 853 |
-
# }
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
# }
|
| 858 |
-
# ]
|
| 859 |
-
# }
|
| 860 |
-
# res = spreadsheet_service.spreadsheets().batchUpdate(spreadsheetId=spreadsheetId, body=body).execute()
|
| 861 |
-
# # if splittedpdfpath[-2].startswith('1.0'):
|
| 862 |
-
# endColindex=10
|
| 863 |
-
# endrow=3
|
| 864 |
-
# body2={
|
| 865 |
-
# "requests": [
|
| 866 |
-
# {
|
| 867 |
-
# "updateBorders": {
|
| 868 |
-
# "range": {
|
| 869 |
-
# "sheetId": sheetId,
|
| 870 |
-
# "startRowIndex": 0,
|
| 871 |
-
# "endRowIndex": len(SimilarAreaDictionary)+endrow,
|
| 872 |
-
# "startColumnIndex": 0,
|
| 873 |
-
# "endColumnIndex": endColindex
|
| 874 |
-
# },
|
| 875 |
-
# "top": {
|
| 876 |
-
# "style": "SOLID",
|
| 877 |
-
# "width": 2,
|
| 878 |
-
# "color": {
|
| 879 |
-
# "red": 0.0,
|
| 880 |
-
# "green":0.0,
|
| 881 |
-
# "blue":0.0
|
| 882 |
-
# },
|
| 883 |
-
# },
|
| 884 |
-
# "bottom": {
|
| 885 |
-
# "style": "SOLID",
|
| 886 |
-
# "width": 2,
|
| 887 |
-
# "color": {
|
| 888 |
-
# "red": 0.0,
|
| 889 |
-
# "green":0.0,
|
| 890 |
-
# "blue":0.0
|
| 891 |
-
# },
|
| 892 |
-
# },
|
| 893 |
-
# "left":{
|
| 894 |
-
# "style": "SOLID",
|
| 895 |
-
# "width":2,
|
| 896 |
-
# "color": {
|
| 897 |
-
# "red": 0.0,
|
| 898 |
-
# "green":0.0,
|
| 899 |
-
# "blue":0.0
|
| 900 |
-
# },
|
| 901 |
-
# },
|
| 902 |
-
# "right":{
|
| 903 |
-
# "style": "SOLID",
|
| 904 |
-
# "width": 2,
|
| 905 |
-
# "color": {
|
| 906 |
-
# "red": 0.0,
|
| 907 |
-
# "green":0.0,
|
| 908 |
-
# "blue":0.0
|
| 909 |
-
# },
|
| 910 |
-
# },
|
| 911 |
-
# "innerHorizontal":{
|
| 912 |
-
# "style": "SOLID",
|
| 913 |
-
# "width":2,
|
| 914 |
-
# "color": {
|
| 915 |
-
# "red": 0.0,
|
| 916 |
-
# "green":0.0,
|
| 917 |
-
# "blue":0.0
|
| 918 |
-
# },
|
| 919 |
-
# },
|
| 920 |
-
# "innerVertical": {
|
| 921 |
-
# "style": "SOLID",
|
| 922 |
-
# "width": 2,
|
| 923 |
-
# "color": {
|
| 924 |
-
# "red": 0.0,
|
| 925 |
-
# "green":0.0,
|
| 926 |
-
# "blue":0.0
|
| 927 |
-
# },
|
| 928 |
-
# },
|
| 929 |
-
# }
|
| 930 |
-
# }
|
| 931 |
-
# ]
|
| 932 |
-
# }
|
| 933 |
-
# spreadsheet_service.spreadsheets().batchUpdate(spreadsheetId=spreadsheetId, body=body2).execute()
|
| 934 |
-
|
| 935 |
-
# model_cell =worksheet.cell('A1')
|
| 936 |
-
# model_cell.set_text_format('bold', True)
|
| 937 |
-
# model_cell.set_horizontal_alignment( pygsheets.custom_types.HorizontalAlignment.CENTER )
|
| 938 |
-
# model_cell.color = (213/255, 219/255 ,255/255)
|
| 939 |
-
# pygsheets.DataRange('A2','J2', worksheet=worksheet).apply_format(model_cell)
|
| 940 |
-
# spreadsheet_url = "https://docs.google.com/spreadsheets/d/%s" % spreadsheetId
|
| 941 |
-
# print(spreadsheet_url)
|
| 942 |
-
# drive_service.permissions().update(transferOwnership=True , fileId=spreadsheetId,permissionId='11OfoB4Z6wOVII8mYmbnCbbqTQs7rYA65')
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
# return gc,spreadsheet_service,spreadsheetId ,spreadsheet_url , namepathArr
|
| 946 |
-
# #######################
|
| 947 |
-
|
| 948 |
-
# def mapnametoLegend(McTName):
|
| 949 |
-
|
| 950 |
-
# sectionKey = McTName.pop()
|
| 951 |
-
# key=sectionKey[0]
|
| 952 |
-
# section=sectionKey[1]
|
| 953 |
-
|
| 954 |
-
# spreadsheet_service,drive_service,gc=authorizeLegend()
|
| 955 |
-
# spreadsheet_key =str(key) # Please set the Spreadsheet ID.
|
| 956 |
-
|
| 957 |
-
# ws = gc.open_by_key(spreadsheet_key)
|
| 958 |
-
# # guessednamesfinal=getguessnames(gc,ws)
|
| 959 |
-
# sheetnames=[]
|
| 960 |
-
# unit=''
|
| 961 |
-
# # ws.add_worksheet("Summary") # Please set the new sheet name.
|
| 962 |
-
# for i in ws._sheet_list:
|
| 963 |
-
# print(i)
|
| 964 |
-
# sheetnames.append(i.title)
|
| 965 |
-
# print(i.index)
|
| 966 |
-
# if 'XML Export Summary' in sheetnames:
|
| 967 |
-
# worksheetS = ws.worksheet_by_title('XML Export Summary')
|
| 968 |
-
# else:
|
| 969 |
-
# ws.add_worksheet("XML Export Summary") # Please set the new sheet name.
|
| 970 |
-
# worksheetw = ws.worksheet(0) #legend
|
| 971 |
-
# worksheetS = ws.worksheet_by_title('XML Export Summary')
|
| 972 |
-
# summaryId= ws[1].id
|
| 973 |
-
# print('summaryyyID',summaryId)
|
| 974 |
-
# print('summaryyyID2',worksheetS.id)
|
| 975 |
-
# worksheetS.clear()
|
| 976 |
-
|
| 977 |
-
# countnames=0
|
| 978 |
-
# row0=['MC_T Name','Qty','Unit']
|
| 979 |
-
# worksheetS.update_row(1,row0)
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
# for i in range(len(McTName)):
|
| 983 |
-
# allgbnames=''
|
| 984 |
-
# item=''
|
| 985 |
-
# print(McTName[i][0])
|
| 986 |
-
|
| 987 |
-
# # firstpart= re.split(r'[`\-=~!@#$%^&*()_+\[\]{};\'\\:"|<,./<>?]', McTName[i][0])
|
| 988 |
-
# print('kkk' ,McTName[i][2])
|
| 989 |
-
# if McTName[i][2].startswith('Area'):
|
| 990 |
-
# if section.startswith('1.0'):
|
| 991 |
-
# rowvalue=5# column 5
|
| 992 |
-
# elif section.startswith('3.2'):
|
| 993 |
-
# rowvalue=3
|
| 994 |
-
# ar=0
|
| 995 |
-
# unit='m2'
|
| 996 |
-
# if McTName[i][2].startswith('Perimeter'):
|
| 997 |
-
# if section.startswith('1.0'):
|
| 998 |
-
# rowvalue=7# column 7
|
| 999 |
-
# elif section.startswith('3.2'):
|
| 1000 |
-
# rowvalue=3
|
| 1001 |
-
# ar=0
|
| 1002 |
-
# unit='m'
|
| 1003 |
-
# if McTName[i][2].startswith('Length'):
|
| 1004 |
-
# if section.startswith('1.0'):
|
| 1005 |
-
# rowvalue=9# column 7
|
| 1006 |
-
# elif section.startswith('3.2'):
|
| 1007 |
-
# rowvalue=3
|
| 1008 |
-
# ar=0
|
| 1009 |
-
# unit='m'
|
| 1010 |
-
# if McTName[i][2].startswith('Count'):
|
| 1011 |
-
# if section.startswith('1.0'):
|
| 1012 |
-
# rowvalue=3# column 7
|
| 1013 |
-
# elif section.startswith('3.2'):
|
| 1014 |
-
# rowvalue=3
|
| 1015 |
-
# ar=0
|
| 1016 |
-
# unit='Nr'
|
| 1017 |
-
|
| 1018 |
-
# print('mcct',McTName[i][1])
|
| 1019 |
-
# if isinstance(McTName[i][1], list):
|
| 1020 |
-
# guessednames=worksheetw.get_col(1, returnas='matrix', include_tailing_empty=False)
|
| 1021 |
-
|
| 1022 |
-
# for m in McTName[i][1]:
|
| 1023 |
-
# if m:
|
| 1024 |
-
# if m.startswith('text1'):
|
| 1025 |
-
# name=m.removeprefix('text1')
|
| 1026 |
-
# allgbnames+= name +' +'
|
| 1027 |
-
# indices = [o for o, x in enumerate(guessednames) if x == name]
|
| 1028 |
-
# print(indices)
|
| 1029 |
-
# for j in range(len(indices)):
|
| 1030 |
-
# # print('kjjjj',roww[j])
|
| 1031 |
-
# ar+=float(worksheetw.cell((indices[j]+1 ,rowvalue)).value)
|
| 1032 |
-
# else:
|
| 1033 |
-
# item+=m + ' ,'
|
| 1034 |
-
# print(item)
|
| 1035 |
-
# n= McTName[i][0] + ' ( '+ allgbnames[:-2] +' , ' + item[:-1] + ' ) '
|
| 1036 |
-
# else:
|
| 1037 |
-
# if McTName[i][1].startswith('text1'):
|
| 1038 |
-
# name=McTName[i][1].removeprefix('text1')
|
| 1039 |
-
# allgbnames+= name
|
| 1040 |
-
|
| 1041 |
-
# roww=worksheetw.find(name)
|
| 1042 |
-
# print(roww)
|
| 1043 |
-
# for j in range(len(roww)):
|
| 1044 |
-
# print('kjjjj',roww[j])
|
| 1045 |
-
# ar+=float(worksheetw.cell((roww[j].row ,rowvalue)).value)
|
| 1046 |
-
# n= McTName[i][0] + ' ( '+ allgbnames + ' ) '
|
| 1047 |
-
|
| 1048 |
-
# rowi=[str(n),ar,unit]
|
| 1049 |
-
# worksheetS.update_row(i+2,rowi)
|
| 1050 |
-
# # worksheetS.adjust_column_width(start=1,end=4)
|
| 1051 |
-
# worksheetS.adjust_column_width(start=1,end=1, pixel_size=350)
|
| 1052 |
-
# worksheetS.adjust_column_width(start=2,end=2, pixel_size=100)
|
| 1053 |
-
# worksheetS.adjust_column_width(start=3,end=3)
|
| 1054 |
-
|
| 1055 |
-
# xx=(worksheetS.cell( ( len(McTName) +1 ,3)) ).address.label
|
| 1056 |
-
# model_cell1 =worksheetS.cell('A2')
|
| 1057 |
-
# model_cell1.set_horizontal_alignment( pygsheets.custom_types.HorizontalAlignment.LEFT )
|
| 1058 |
-
# pygsheets.DataRange('A2', str(xx), worksheet=worksheetS).apply_format(model_cell1)
|
| 1059 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1060 |
|
| 1061 |
-
|
| 1062 |
-
# model_cell.set_text_format('bold', True)
|
| 1063 |
-
# model_cell.set_horizontal_alignment( pygsheets.custom_types.HorizontalAlignment.CENTER )
|
| 1064 |
-
# pygsheets.DataRange('A1','C1', worksheet=worksheetS).apply_format(model_cell)
|
| 1065 |
-
|
| 1066 |
-
# body2={
|
| 1067 |
-
# "requests": [
|
| 1068 |
-
# {
|
| 1069 |
-
# "updateBorders": {
|
| 1070 |
-
# "range": {
|
| 1071 |
-
# "sheetId": str(summaryId),
|
| 1072 |
-
# "startRowIndex": 0,
|
| 1073 |
-
# "endRowIndex": len(McTName) +1 ,
|
| 1074 |
-
# "startColumnIndex": 0,
|
| 1075 |
-
# "endColumnIndex": 3
|
| 1076 |
-
# },
|
| 1077 |
-
# "top": {
|
| 1078 |
-
# "style": "SOLID",
|
| 1079 |
-
# "width": 2,
|
| 1080 |
-
# "color": {
|
| 1081 |
-
# "red": 0.0,
|
| 1082 |
-
# "green":0.0,
|
| 1083 |
-
# "blue":0.0
|
| 1084 |
-
# },
|
| 1085 |
-
# },
|
| 1086 |
-
# "bottom": {
|
| 1087 |
-
# "style": "SOLID",
|
| 1088 |
-
# "width": 2,
|
| 1089 |
-
# "color": {
|
| 1090 |
-
# "red": 0.0,
|
| 1091 |
-
# "green":0.0,
|
| 1092 |
-
# "blue":0.0
|
| 1093 |
-
# },
|
| 1094 |
-
# },
|
| 1095 |
-
# "left":{
|
| 1096 |
-
# "style": "SOLID",
|
| 1097 |
-
# "width":2,
|
| 1098 |
-
# "color": {
|
| 1099 |
-
# "red": 0.0,
|
| 1100 |
-
# "green":0.0,
|
| 1101 |
-
# "blue":0.0
|
| 1102 |
-
# },
|
| 1103 |
-
# },
|
| 1104 |
-
# "right":{
|
| 1105 |
-
# "style": "SOLID",
|
| 1106 |
-
# "width": 2,
|
| 1107 |
-
# "color": {
|
| 1108 |
-
# "red": 0.0,
|
| 1109 |
-
# "green":0.0,
|
| 1110 |
-
# "blue":0.0
|
| 1111 |
-
# },
|
| 1112 |
-
# },
|
| 1113 |
-
# "innerHorizontal":{
|
| 1114 |
-
# "style": "SOLID",
|
| 1115 |
-
# "width":2,
|
| 1116 |
-
# "color": {
|
| 1117 |
-
# "red": 0.0,
|
| 1118 |
-
# "green":0.0,
|
| 1119 |
-
# "blue":0.0
|
| 1120 |
-
# },
|
| 1121 |
-
# },
|
| 1122 |
-
# "innerVertical": {
|
| 1123 |
-
# "style": "SOLID",
|
| 1124 |
-
# "width": 2,
|
| 1125 |
-
# "color": {
|
| 1126 |
-
# "red": 0.0,
|
| 1127 |
-
# "green":0.0,
|
| 1128 |
-
# "blue":0.0
|
| 1129 |
-
# },
|
| 1130 |
-
# },
|
| 1131 |
-
# }
|
| 1132 |
-
# }
|
| 1133 |
-
# ]
|
| 1134 |
-
# }
|
| 1135 |
-
# spreadsheet_service.spreadsheets().batchUpdate(spreadsheetId=spreadsheet_key, body=body2).execute()
|
| 1136 |
-
# return summaryId #,guessednamesfinal
|
| 1137 |
-
|
| 1138 |
-
# # print(x,xarea)
|
| 1139 |
-
|
| 1140 |
-
# def getguessnames(gc,ws):
|
| 1141 |
-
# guessednamesfinal=[]
|
| 1142 |
-
# worksheetw = ws.worksheet(0)
|
| 1143 |
-
# guessednames=worksheetw.get_col(1, returnas='matrix', include_tailing_empty=False)
|
| 1144 |
-
# print(guessednames[2:])
|
| 1145 |
-
# for item in guessednames[2:]:
|
| 1146 |
-
# if item not in guessednamesfinal:
|
| 1147 |
-
# guessednamesfinal.append(item)
|
| 1148 |
-
# print(guessednamesfinal)
|
| 1149 |
-
# return guessednamesfinal
|
| 1150 |
-
|
| 1151 |
-
# ################################################################
|
| 1152 |
-
|
| 1153 |
-
# def deletefromlegend(deletedrows,SimilarAreaDictionarycopy,section, areaPermArr=[]):
|
| 1154 |
-
# items=[]
|
| 1155 |
-
# idx=0
|
| 1156 |
-
# if section.startswith('1.0'):
|
| 1157 |
-
# areaPermArr=ast.literal_eval(areaPermArr)
|
| 1158 |
-
# myDict=eval(SimilarAreaDictionarycopy)
|
| 1159 |
-
# SimilarAreaDictionarycopy=pd.DataFrame(myDict)
|
| 1160 |
-
# # deletedrows=eval(deletedrows)
|
| 1161 |
-
# strings=deletedrows['content']
|
| 1162 |
-
# areastodelete = []
|
| 1163 |
-
# perimstodelete=[]
|
| 1164 |
-
# lengthstodelete=[]
|
| 1165 |
-
|
| 1166 |
-
|
| 1167 |
-
# for item in strings:
|
| 1168 |
-
# items.append(str(item).split('\n \n'))
|
| 1169 |
-
# # print('itemsssssss',float(re.findall("\d+\.\d+", str(items[i][0]).split()[0])[0])) #take area and perim mn hna l sec 3.2 and +/- value margin
|
| 1170 |
-
|
| 1171 |
-
# for i in range(len(items)):
|
| 1172 |
-
# print('ITEMSS',str(items[i]).split())
|
| 1173 |
-
# items=ast.literal_eval(str(items[i]))
|
| 1174 |
-
# areastodelete.append(float(re.findall("\d+\.\d+", str(items[i][0]).split()[1])[0]))
|
| 1175 |
-
# perimstodelete.append(float(re.findall("\d+\.\d+", str(items[i][1]).split()[1])[0]) )
|
| 1176 |
-
# lengthstodelete.append(float(re.findall("\d+\.\d+", str(items[i][2]).split()[1])[0]) )
|
| 1177 |
-
|
| 1178 |
-
# for i in range(len(areastodelete)):#item in areastodelete:
|
| 1179 |
-
# areamin=round(areastodelete[i],1)- 0.3
|
| 1180 |
-
# areamax=round(areastodelete[i],1)+ 0.3
|
| 1181 |
-
# perimmin=round(perimstodelete[i],1)- 0.3
|
| 1182 |
-
# perimmax=round(perimstodelete[i],1)+ 0.3
|
| 1183 |
-
# if section.startswith('1.0'):
|
| 1184 |
-
# for p in range(len(areaPermArr)):
|
| 1185 |
-
|
| 1186 |
-
# if areastodelete[i] in areaPermArr[p]:
|
| 1187 |
-
# print('AAA',areaPermArr[p])
|
| 1188 |
-
# area= areaPermArr[p][0]
|
| 1189 |
-
# width= areaPermArr[p][1]
|
| 1190 |
-
# height= areaPermArr[p][2]
|
| 1191 |
-
# # if section.startswith('1.0'):
|
| 1192 |
-
# widthMin= width -10
|
| 1193 |
-
# widthMax= width +10
|
| 1194 |
-
# heightMin = height-10
|
| 1195 |
-
# heightMax=height+10
|
| 1196 |
-
# found=SimilarAreaDictionarycopy.loc[SimilarAreaDictionarycopy.index[((SimilarAreaDictionarycopy['Rounded'] >=areamin) & (SimilarAreaDictionarycopy['Rounded']<=areamax) & (SimilarAreaDictionarycopy['Perimeter'] >=perimmin) & (SimilarAreaDictionarycopy['Perimeter']<=perimmax) ) & ( ((SimilarAreaDictionarycopy['Width']>=widthMin) & (SimilarAreaDictionarycopy['Width']<=widthMax) & (SimilarAreaDictionarycopy['Height']>=heightMin) & (SimilarAreaDictionarycopy['Height']<=heightMax) ) | ((SimilarAreaDictionarycopy['Width']>=heightMin) & (SimilarAreaDictionarycopy['Width']<=heightMax) & (SimilarAreaDictionarycopy['Height']>=widthMin) & (SimilarAreaDictionarycopy['Height']<=widthMax) )) ]]
|
| 1197 |
-
# elif section.startswith('3.2'):
|
| 1198 |
-
# areamin=round(areastodelete[i],1)- 0.1
|
| 1199 |
-
# areamax= round(areastodelete[i],1) + 0.1
|
| 1200 |
-
|
| 1201 |
-
# found=SimilarAreaDictionarycopy.loc[SimilarAreaDictionarycopy.index[((SimilarAreaDictionarycopy['Area'] >=areamin) & (SimilarAreaDictionarycopy['Area']<=areamax) )]]
|
| 1202 |
-
|
| 1203 |
-
# if len(found.index.values ) >0:
|
| 1204 |
-
# occ=SimilarAreaDictionarycopy.loc[found.index.values[0],'Occurences']
|
| 1205 |
-
# if occ== 1: #drop row
|
| 1206 |
-
# print('occ=1')
|
| 1207 |
-
# SimilarAreaDictionarycopy= SimilarAreaDictionarycopy.drop(found.index.values[0])
|
| 1208 |
-
|
| 1209 |
-
# else: #occ minus 1 , total area - areavalue , total perim - perimvalue
|
| 1210 |
-
# print('occ>1')
|
| 1211 |
-
# if section.startswith('1.0'):
|
| 1212 |
-
# idx=SimilarAreaDictionarycopy.index[((SimilarAreaDictionarycopy['Rounded'] >=areamin) & (SimilarAreaDictionarycopy['Rounded']<=areamax) & (SimilarAreaDictionarycopy['Perimeter'] >=perimmin) & (SimilarAreaDictionarycopy['Perimeter']<=perimmax) ) & ( ((SimilarAreaDictionarycopy['Width']>=widthMin) & (SimilarAreaDictionarycopy['Width']<=widthMax) & (SimilarAreaDictionarycopy['Height']>=heightMin) & (SimilarAreaDictionarycopy['Height']<=heightMax) ) | ((SimilarAreaDictionarycopy['Width']>=heightMin) & (SimilarAreaDictionarycopy['Width']<=heightMax) & (SimilarAreaDictionarycopy['Height']>=widthMin) & (SimilarAreaDictionarycopy['Height']<=widthMax) )) ]
|
| 1213 |
-
# elif section.startswith('3.2'):
|
| 1214 |
-
# perimmin=round(perimstodelete[i],1)- 50
|
| 1215 |
-
# perimmax=round(perimstodelete[i],1)+ 50
|
| 1216 |
-
# idx=SimilarAreaDictionarycopy.index[((SimilarAreaDictionarycopy['Area'] >=areamin) & (SimilarAreaDictionarycopy['Area']<=areamax) & (SimilarAreaDictionarycopy['Perimeter'] >=perimmin) & (SimilarAreaDictionarycopy['Perimeter']<=perimmax) )]
|
| 1217 |
-
# SimilarAreaDictionarycopy.loc[idx,'Total Area'] = SimilarAreaDictionarycopy.loc[idx,'Total Area'] - areastodelete[i]
|
| 1218 |
-
# SimilarAreaDictionarycopy.loc[idx,'Total Perimeter'] = SimilarAreaDictionarycopy.loc[idx,'Total Perimeter'] - perimstodelete[i]
|
| 1219 |
-
# SimilarAreaDictionarycopy.loc[idx,'Total Length'] = SimilarAreaDictionarycopy.loc[idx,'Total Length'] - lengthstodelete[i]
|
| 1220 |
-
# SimilarAreaDictionarycopy.loc[idx,'Occurences'] = int(SimilarAreaDictionarycopy.loc[idx,'Occurences']) - 1
|
| 1221 |
-
# return SimilarAreaDictionarycopy
|
| 1222 |
-
|
| 1223 |
-
# #############################################################
|
|
|
|
| 59 |
splittedpdfpath = re.split(r'[`\-=~!@#$%^&*()_+\[\]{};\'\\:"|<,/<>?]', pdfpath)
|
| 60 |
if splittedpdfpath[-2].startswith('2.2') or splittedpdfpath[-2].startswith('2.1'):
|
| 61 |
worksheet.set_dataframe(start='A1', df=SimilarAreaDictionary)
|
| 62 |
+
if splittedpdfpath[-2].startswith('2.8'):
|
| 63 |
+
DoorsLegend(SimilarAreaDictionary,spreadsheetId,worksheet)
|
| 64 |
+
return
|
| 65 |
+
|
| 66 |
else:
|
| 67 |
top_header_format = [
|
| 68 |
{'mergeCells': { # areas
|
|
|
|
| 632 |
SimilarAreaDictionarycopy.loc[idx,'Total Perimeter'] = SimilarAreaDictionarycopy.loc[idx,'Total Perimeter'] - perimstodelete[i]
|
| 633 |
return SimilarAreaDictionarycopy
|
| 634 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
| 635 |
|
| 636 |
+
def DoorsLegend(Dictionary,spreadsheetId,worksheet):
|
| 637 |
+
top_header_format = [
|
| 638 |
+
{'mergeCells': { # legend and data created
|
| 639 |
+
'mergeType': 'MERGE_ROWS',
|
| 640 |
+
'range': {
|
| 641 |
+
'sheetId': '0',
|
| 642 |
+
'startRowIndex': 0,
|
| 643 |
+
'endRowIndex': 1,
|
| 644 |
+
'startColumnIndex': 0,
|
| 645 |
+
'endColumnIndex': 2
|
| 646 |
+
}
|
| 647 |
+
}}
|
| 648 |
+
]
|
| 649 |
+
spreadsheet_service.spreadsheets().batchUpdate(spreadsheetId=spreadsheetId, body={'requests': top_header_format}).execute()
|
| 650 |
+
worksheet.cell((1, 1)).value = 'Legend and Data Created'
|
| 651 |
+
worksheet.set_dataframe(start='A2', df=Dictionary)
|
| 652 |
+
|
| 653 |
+
body2={
|
| 654 |
+
"requests": [
|
| 655 |
+
{
|
| 656 |
+
"updateBorders": {
|
| 657 |
+
"range": {
|
| 658 |
+
"sheetId": str(0),
|
| 659 |
+
"startRowIndex": 0,
|
| 660 |
+
"endRowIndex": 4,
|
| 661 |
+
"startColumnIndex": 0,
|
| 662 |
+
"endColumnIndex": 2
|
| 663 |
+
},
|
| 664 |
+
"top": {
|
| 665 |
+
"style": "SOLID",
|
| 666 |
+
"width": 2,
|
| 667 |
+
"color": {
|
| 668 |
+
"red": 0.0,
|
| 669 |
+
"green":0.0,
|
| 670 |
+
"blue":0.0
|
| 671 |
+
},
|
| 672 |
+
},
|
| 673 |
+
"bottom": {
|
| 674 |
+
"style": "SOLID",
|
| 675 |
+
"width": 2,
|
| 676 |
+
"color": {
|
| 677 |
+
"red": 0.0,
|
| 678 |
+
"green":0.0,
|
| 679 |
+
"blue":0.0
|
| 680 |
+
},
|
| 681 |
+
},
|
| 682 |
+
"left":{
|
| 683 |
+
"style": "SOLID",
|
| 684 |
+
"width":2,
|
| 685 |
+
"color": {
|
| 686 |
+
"red": 0.0,
|
| 687 |
+
"green":0.0,
|
| 688 |
+
"blue":0.0
|
| 689 |
+
},
|
| 690 |
+
},
|
| 691 |
+
"right":{
|
| 692 |
+
"style": "SOLID",
|
| 693 |
+
"width": 2,
|
| 694 |
+
"color": {
|
| 695 |
+
"red": 0.0,
|
| 696 |
+
"green":0.0,
|
| 697 |
+
"blue":0.0
|
| 698 |
+
},
|
| 699 |
+
},
|
| 700 |
+
"innerHorizontal":{
|
| 701 |
+
"style": "SOLID",
|
| 702 |
+
"width":2,
|
| 703 |
+
"color": {
|
| 704 |
+
"red": 0.0,
|
| 705 |
+
"green":0.0,
|
| 706 |
+
"blue":0.0
|
| 707 |
+
},
|
| 708 |
+
},
|
| 709 |
+
"innerVertical": {
|
| 710 |
+
"style": "SOLID",
|
| 711 |
+
"width": 2,
|
| 712 |
+
"color": {
|
| 713 |
+
"red": 0.0,
|
| 714 |
+
"green":0.0,
|
| 715 |
+
"blue":0.0
|
| 716 |
+
},
|
| 717 |
+
},
|
| 718 |
+
}
|
| 719 |
+
}
|
| 720 |
+
]
|
| 721 |
+
}
|
| 722 |
+
spreadsheet_service.spreadsheets().batchUpdate(spreadsheetId=spreadsheetId, body=body2).execute()
|
| 723 |
+
model_cell = worksheet.cell('A1')
|
| 724 |
+
model_cell.set_text_format('bold', True)
|
| 725 |
+
model_cell.set_horizontal_alignment(pygsheets.custom_types.HorizontalAlignment.CENTER)
|
| 726 |
+
model_cell.color = (213 / 255, 219 / 255, 255 / 255)
|
| 727 |
+
pygsheets.DataRange('A2', 'B2', worksheet=worksheet).apply_format(model_cell)
|
| 728 |
|
| 729 |
+
######################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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