https://tanaikech.github.io/2019/05/22/ ... ps-script/
, чтобы создать таблицу, и она хорошо сработала. Но проблема началась после этого, когда я попытался ввести индекс текста/перемещения рядом с таблицей, я получаю проблему, что все, что я делаю, любой индекс, который я выберет, оно заканчивается в одной из ячеек в таблице, или я получаю индекс из -за ошибки в диапазоне. : (
Пожалуйста, помогите мне с этими ребятами. Как я могу переместить индекс рядом с таблицей. < /p>
Ниже приведен код, который я использую: < /p>
Код: Выделить всё
# Add the table for assessment score and stage
requests.append({"insertTable": {"rows": 6, "columns": 2, "location": {"index": index}}})
# Insert the rows for the table
requests.append({"insertText": {"text": "Severe dementia", "location": {"index": index + 31}}})
requests.append({"insertText": {"text": "21-30", "location": {"index": index + 29}}})
requests.append({"insertText": {"text": "Moderate dementia", "location": {"index": index + 26}}})
requests.append({"insertText": {"text": "13-20.5", "location": {"index": index + 24}}})
requests.append({"insertText": {"text": "Mild dementia", "location": {"index": index + 21}}})
requests.append({"insertText": {"text": "6-12.5", "location": {"index": index + 19}}})
requests.append({"insertText": {"text": "Mild cognitive impairment", "location": {"index": index + 16}}})
requests.append({"insertText": {"text": "2-5.5", "location": {"index": index + 14}}})
requests.append({"insertText": {"text": "Normal (dementia unlikely)", "location": {"index": index + 11}}})
requests.append({"insertText": {"text": "0-1.5", "location": {"index": index + 9}}})
# Insert the header row
requests.append({"insertText": {"text": "Dementia Stage", "location": {"index": index + 6}}})
requests.append({
"updateTextStyle": {
"range": {
"startIndex": index + 6,
"endIndex": index + 6 + len("Dementia Stage")
},
"textStyle": {
"bold": True
},
"fields": "bold"
}
})
requests.append({"insertText": {"text": "QDRS Score", "location": {"index": index + 4}}})
requests.append({
"updateTextStyle": {
"range": {
"startIndex": index + 4,
"endIndex": index + 4 + len("QDRS Score")
},
"textStyle": {
"bold": True
},
"fields": "bold"
}
})
# Return the modified requests and updated index
return requests, index
Подробнее здесь: https://stackoverflow.com/questions/795 ... docs-api-p