@Gary-Luk, this should be doable.

The first step I would tackle, if you haven't already, is to create an "on" Alexa routine that turns your Kasa plug on when you trigger a command, then do the same for "off". This Youtube video shows how to connect Alexa routines to TRIGGERcmd triggers. It requires the TRIGGERcmd Smart Home Alexa skill to be enabled first.

For the script, I asked the TRIGGERcmd AI Script Assistant this:
1583834d-6ba4-4772-b402-a464b3ce60c9-image.png

This was the response:

import gspread from oauth2client.service_account import ServiceAccountCredentials import requests import time # Set up credentials to access Google Sheets API scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] creds = ServiceAccountCredentials.from_json_keyfile_name('path/to/credentials.json', scope) client = gspread.authorize(creds) # Open the Google Sheet with the schedule sheet = client.open('Schedule').sheet1 # Loop through the rows of the schedule while True: for row in sheet.get_all_records(): # Get the current time current_time = time.strftime('%H:%M') # Check if it's time to turn something on if current_time == row['On Time']: # Call the HTTPS API to turn something on response = requests.post('https://api.example.com/turn-on') # Check if it's time to turn something off if current_time == row['Off Time']: # Call the HTTPS API to turn something off response = requests.post('https://api.example.com/turn-off') # Wait for 1 minute before checking the schedule again time.sleep(60)

You'll need to replace that generic API example with one that calls the trigger command API instead.