Is there a way to set RTL (Right-to-left) and LTR (left-to-right) to sheets/cells in Python, perhaps with gspread or gspread-formatting packages? Does Google Sheet's API even support this?
I couldn't find any related documentation...
UPDATE: I eventually did find right-to-left reference in Google Sheet's API for sheets and for text in cells. So this may be a matter of implementation in the python packages. I went ahead and opened a gspread package feature request and gspread-formatting package feature request
I believe your goal is as follows.
In your situation, how about the following sample script?
client = # Please use your client of gspread.
spreadsheetId = "###" # Please set your Spreadsheet ID.
sheetName = "Sheet1" # Please set your sheet name.
spreadsheet = client.open_by_key(spreadsheetId)
sheet = spreadsheet.worksheet(sheetName)
data = {
"requests": [
{
"updateSheetProperties": {
"properties": {"rightToLeft": True, "sheetId": sheet.id},
"fields": "rightToLeft",
}
}
]
}
spreadsheet.batch_update(data)
sheetName
of Spreadsheet of spreadsheetId
is used.
rightToLeft
: True if the sheet is an RTL sheet instead of an LTR sheet.