8

I want to retrieve only sheet's data from a spreadsheet with formatting.

How to achieve the same with Sheets Api?

1 Answer 1

17

It isn't clear from your question just what kind of data you want to get. Do you want to retrieve the values as they're formatted in the Google Sheets UI? If so, then use the spreadsheets.values.get API. The parameter valueRenderOption controls how the values are formatted. By default, the value is FORMATTED_VALUE, which will return the data as it's formatted in the Sheets UI. Other values are listed on the ValueRenderOption reference page. See the Basic Reading sample for more information.

If you want to retrieve the information about the format itself, use the spreadsheets.get API. Format information is in the response's CellData (at sheets.data.rowData.values), in both the userEnteredFormat and effectiveFormat fields.

Sign up to request clarification or add additional context in comments.

2 Comments

I want to get things like cell border, color, etc with the data in those cells
The latter part of my answer is what you're looking for then, using spreadsheets.get and the userEnteredFormat or effectiveFormat of the CellData.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.