Answer the question
In order to leave comments, you need to log in
How to perform consistent data validation in Google Seets?
There is a table (I can’t show the key in full) here I read the key and ID, ID is the page identifier in the working comment. Now my program takes the key from the first column, performs a check on a certain site, and depending on the result of the check, it either sends a comment to the workspace that everything is fine with the key and you can use it.
The problem is that I had 76 keys, now out of 130, and my programming strength was enough to prescribe the processing of each cell with writing to a variable and checking. I got 4000 lines for 76 keys, maybe there is some simpler way, somehow write the check into a function and call it for each variable, but I just can’t figure out how and with what help I can do it. This is what a block of 2 cells looks like:
try:
values_guid = service.spreadsheets().values().get(
spreadsheetId=spreadsheet_id,
range='A3:A3',
majorDimension='COLUMNS'
).execute()
res = values_guid['values'][0][0]
values_id1 = service.spreadsheets().values().get(
spreadsheetId=spreadsheet_id,
range='B3:B3',
majorDimension='COLUMNS'
).execute()
res_id2 = values_id1['values'][0][0]
res_id_2 = int(res_id2)
try:
options = Options()
options.headless = True
# driver = webdriver.Chrome()
driver = webdriver.Chrome(chrome_options=options)
driver.get(url=url)
driver.find_element_by_tag_name('input').send_keys(res)
driver.find_element_by_tag_name('button').click()
time.sleep(0.5)
if driver.find_elements_by_xpath('//span[@class="label label-success"][1]'):
if True:
request = pyrus.models.requests.TaskCommentRequest(text="Подтверждена, убери пожалуйса свой GUID из этой таблицы https://clck.ru/Yh****, action="")
task = pyrus_client.comment_task(res_id_2, request).task
res = print('Подтверждена, убери пожалуйса свой GUID из этой таблицы https://clck.ru/YhBqZ')
results = service.spreadsheets().values().batchUpdate(spreadsheetId = spreadsheetId, body = {
elif driver.find_elements_by_xpath('//span[@class="label label-warning"][1]'):
if True:
request = pyrus.models.requests.TaskCommentRequest(text="", action="")
task = pyrus_client.comment_task(res_id_2, request).task
print('')
elif driver. find_elements_by_tag_name("tbody"):
if True:
request = pyrus.models.requests.TaskCommentRequest(text="Площадка не найдена", action="")
task = pyrus_client.comment_task(res_id_2, request).task
print('Ошибка, площадка не найдена.')
except Exception as ex:
print(ex)
finally:
driver.close()
driver.quit()
except KeyError:
pass
Answer the question
In order to leave comments, you need to log in
I got 4000 lines for 76 keys
range='A3:A3',
for row in range(3, 130):
values_guid = service.spreadsheets().values().get(
spreadsheetId=spreadsheet_id,
range=f'A{row}:A{row}',
majorDimension='COLUMNS'
).execute()
#ну и так далее
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question