mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
get hubspot listing id from spreadsheet
This commit is contained in:
parent
a4a3a3b46f
commit
849a272974
2 changed files with 11 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ from openpyxl.worksheet.worksheet import Worksheet
|
||||||
class PropertyRow:
|
class PropertyRow:
|
||||||
row_index: int
|
row_index: int
|
||||||
address: str
|
address: str
|
||||||
|
listing_id: str
|
||||||
|
|
||||||
|
|
||||||
def extract_addresses_from_spreadsheet(
|
def extract_addresses_from_spreadsheet(
|
||||||
|
|
@ -20,6 +21,7 @@ def extract_addresses_from_spreadsheet(
|
||||||
header_row: int = 1
|
header_row: int = 1
|
||||||
id_col: Optional[int] = None
|
id_col: Optional[int] = None
|
||||||
deal_name_col: Optional[int] = None
|
deal_name_col: Optional[int] = None
|
||||||
|
listing_id_col: Optional[int] = None
|
||||||
|
|
||||||
# find columns
|
# find columns
|
||||||
for col in range(1, ws.max_column + 1):
|
for col in range(1, ws.max_column + 1):
|
||||||
|
|
@ -30,8 +32,10 @@ def extract_addresses_from_spreadsheet(
|
||||||
id_col = col
|
id_col = col
|
||||||
elif value == "deal name":
|
elif value == "deal name":
|
||||||
deal_name_col = col
|
deal_name_col = col
|
||||||
|
elif value == "associated listing ids":
|
||||||
|
listing_id_col = col
|
||||||
|
|
||||||
if id_col is None or deal_name_col is None:
|
if id_col is None or deal_name_col is None or listing_id_col is None:
|
||||||
raise Exception("Missing required columns")
|
raise Exception("Missing required columns")
|
||||||
|
|
||||||
properties: Dict[str, PropertyRow] = {}
|
properties: Dict[str, PropertyRow] = {}
|
||||||
|
|
@ -39,8 +43,9 @@ def extract_addresses_from_spreadsheet(
|
||||||
for row in range(2, ws.max_row + 1):
|
for row in range(2, ws.max_row + 1):
|
||||||
id_val: Any = ws.cell(row=row, column=id_col).value
|
id_val: Any = ws.cell(row=row, column=id_col).value
|
||||||
deal_name: Any = ws.cell(row=row, column=deal_name_col).value
|
deal_name: Any = ws.cell(row=row, column=deal_name_col).value
|
||||||
|
listing_id: Any = ws.cell(row=row, column=listing_id_col).value
|
||||||
|
|
||||||
if not id_val or not deal_name:
|
if not id_val or not deal_name or not listing_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
property_id: str = str(id_val).strip()
|
property_id: str = str(id_val).strip()
|
||||||
|
|
@ -48,6 +53,7 @@ def extract_addresses_from_spreadsheet(
|
||||||
properties[property_id] = PropertyRow(
|
properties[property_id] = PropertyRow(
|
||||||
row_index=row,
|
row_index=row,
|
||||||
address=extract_succinct_address(str(deal_name)),
|
address=extract_succinct_address(str(deal_name)),
|
||||||
|
listing_id=listing_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
return properties
|
return properties
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,9 @@ def run_job() -> None:
|
||||||
|
|
||||||
sharepoint_address: str = property_row.address
|
sharepoint_address: str = property_row.address
|
||||||
|
|
||||||
|
# Check whether files have already been processed before continuing with this property
|
||||||
|
# hubspot_listing_id: str = property_row.listing_id
|
||||||
|
|
||||||
go_to_assessment_details(page, row)
|
go_to_assessment_details(page, row)
|
||||||
|
|
||||||
for report_type in REPORT_TYPES:
|
for report_type in REPORT_TYPES:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue