I am trying to use Gspread to insert new columns at a location.
I found add_cols
methods, but it inserts only in the last column of spreadsheet.
There are other methods such as: insert_rows
, resize
or append_rows
but nothing can solve my problem. Did i miss anything?
Thank you
Use the default batch update API for this
spreadsheetId=''
sheetId=''
sht = gc.open_by_key(spreadsheetId)
requests = []
requests.append({
"insertDimension": {
"range": {
"sheetId": sheetId,
"dimension": "COLUMNS",
"startIndex": 2,
"endIndex": 4
},
"inheritFromBefore": True
}
})
body = {
'requests': requests
}
sht.batch_update(body)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With