0

I'm following the google guide and want to create a spreadsheet with populated cells. I've played with API Explorer and got the following working request body:

{
  "sheets": [
    {
      "data": [
        {
          "startRow": 0,
          "rowData": [
            {
              "values": [
                {
                  "userEnteredValue": {
                    "stringValue": "foo"
                  }
                }
              ]
            }
          ]
        },
        {
          "startRow": 1,
          "rowData": [
            {
              "values": [
                {
                  "userEnteredValue": {
                    "numberValue": 10
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

If I pass it as arguement it gives expected result(i.e. creates spreadsheet with data):

request_body = Google::Apis::SheetsV4::Spreadsheet.new(the_request_hash)
response = service.create_spreadsheet(request_body)

Is there a better and more readable way to create populated spreadsheets using ruby?

Szymon Borucki
  • 407
  • 4
  • 13
  • The shown data structure would be trivial to construct from any kind of tabular data. What are your having trouble with? – Jordan Running Apr 11 '17 at 03:47
  • I know it's pretty simple and I've already solved the thing I wanted to accomplish. I was just wandering whether there is a more elegant way to do this. Cheers. – Szymon Borucki Apr 11 '17 at 07:42

0 Answers0