Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Freeze rows and set styles with Google spreadsheet API

If i scroll the spreadsheet ,header field of the rows are hidden and I need bold text format in the same spreadsheet.

Question
Can I set the freeze rows and styles through the spreadsheet api - Is it possible?

like image 402
user3323803 Avatar asked May 09 '14 12:05

user3323803


People also ask

Can I freeze multiple rows in Google Sheets?

Go to the top menu in Google Sheets. Then, click on the “View” tab. And, select the “Freeze” option. From the drop-down, select the option to Freeze any number of rows.

How do you freeze non consecutive rows in sheets?

Freeze and Unfreeze Columns and Rows in Google SheetsSelect the column or row you want to freeze. You can do this by clicking the column letter or row number. Click View from the menu. Go to Freeze and choose what you would like to freeze from the pop-out menu.

How do you apply cell styles in Google Sheets?

Open a spreadsheet in the Google Sheets app. Tap a cell, then drag the blue markers across nearby cells you want to select. In the "Text" tab, choose an option to format your text. In the "Cell" tab, choose an option to format your cell.


1 Answers

This is now available in the v4 API.

Here is the reference for the JAVA API implementation: https://developers.google.com/resources/api-libraries/documentation/sheets/v4/java/latest/com/google/api/services/sheets/v4/model/GridProperties.html#setFrozenRowCount(java.lang.Integer)

Here is the API documentation: https://developers.google.com/sheets/reference/rest/v4/spreadsheets#gridproperties

If you want to do it w/ an App Script you can as well: https://developers.google.com/apps-script/reference/spreadsheet/sheet#setFrozenRows(Integer)

This is the request I made w/ the Ruby API:

update_sheet_properties: {
  properties: {
    sheet_id: 'YOUR SHEET ID HERE',
    grid_properties: { frozen_row_count: 4 }
  },
  fields: 'gridProperties.frozenRowCount'
}
like image 105
Josh Avatar answered Nov 07 '22 00:11

Josh