-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_pr_row.py
More file actions
38 lines (29 loc) · 1 KB
/
update_pr_row.py
File metadata and controls
38 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
from pathlib import Path
from datetime import datetime
SHEET_ID = '1ekrQwL_OHI784GFm-E8KSPynNP4w4MyDYWKh3jELokc'
CREDS_PATH = Path('/Users/ramongonzalez/amazon-data/google_sheets_credentials.json')
def get_service():
creds = Credentials.from_service_account_file(
CREDS_PATH,
scopes=['https://www.googleapis.com/auth/spreadsheets']
)
return build('sheets', 'v4', credentials=creds)
def main():
service = get_service()
# Update Status to "Sent 1" and Last Action Date to today
today = datetime.now().strftime('%m/%d/%Y')
body = {
'values': [['Sent 1', today]]
}
service.spreadsheets().values().update(
spreadsheetId=SHEET_ID,
range='Opportunities!I2:J2',
valueInputOption='RAW',
body=body
).execute()
print(f"Updated Row 2: Status=Sent 1, Date={today}")
if __name__ == '__main__':
main()