Is there any way to AutoFit Column width in Google Sheets using Google Sheets API? I can find only DimensionProperties but it needs exact value n pixels.
Asked
Active
Viewed 7,272 times
1 Answers
20
You can achieve it using autoResizeDimensions of Sheets API. You can see the detail information at below links.
Endpoint
POST https://sheets.googleapis.com/v4/spreadsheets/### fileId ###:batchUpdate
Request body :
{
"requests": [
{
"autoResizeDimensions": {
"dimensions": {
"sheetId": sheetId,
"dimension": "COLUMNS",
"startIndex": 0,
"endIndex": 3
}
}
}
]
}
References :
If I misunderstand your question, I'm sorry.

Tanaike
- 181,128
- 11
- 97
- 165
-
Of course, data needs to exist in the column(s) when executing this request. Silly me... ;) – Jerther Apr 22 '21 at 20:19