Reputation: 355
gspread
has this method for merging cells but I don't find anything for unmerging. I see there's a way to do this in JavaScript, though, but my project is in Python so I would really like to stick to it.
Upvotes: 1
Views: 642
Reputation: 201553
In that case, you can achieve your goal using batch_update
method of gspread. The sample script is as follows.
client = gspread.authorize(credentials) # Here, please use your script.
spreadsheetId = "###" # Please set the Spreadsheet ID.
sheetName = "Sheet1" # Please set the sheet name.
spreadsheet = client.open_by_key(spreadsheetId)
requests = [
{
"unmergeCells": {
"range": {"sheetId": spreadsheet.worksheet(sheetName).id}
}
}
]
spreadsheet.batch_update({"requests": requests})
Upvotes: 2