gsheet.action icon indicating copy to clipboard operation
gsheet.action copied to clipboard

data parameter does not support single value (appendData, updateData)

Open dive-deeper opened this issue 1 year ago • 1 comments

Describe the bug When using appendData or updateData, providing a single value e.g. "data": [[ 1 ]] is invalid.

To Reproduce Steps to reproduce the behavior:

  1. Create a workflow that uses updateData and has a single value in a double array in the data field, for example:
jobs:
  test:
    steps:     
       - name: Gsheet action
         uses: jroehl/[email protected]
         with:
           spreadsheetId: <id>
           commands: |
             [ 
               {  "command": "updateData", "args": { "worksheetTitle": "test1", "data": [[1]], "range": "B1"}} 
             ]
          env:
            GSHEET_CLIENT_EMAIL: ${{ secrets.GSHEET_CLIENT_EMAIL }}
            GSHEET_PRIVATE_KEY: ${{ secrets.GSHEET_PRIVATE_KEY }}
  1. Execute the workflow
  2. Data validation error occurs: ::error::Check "data" property - has to be supplied as nested array ([["1", "2"], ["3", "4"]]). Admittedly, the error does not come directly from this repo and instead from google-sheet-cli. I took a quick look at the code over there and at first glance it looks ok, so maybe it's got something to do on how the data gets passed over? Just guessing though

Expected behavior The action should be successful

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux (Ubuntu)
  • Version 22.04

Additional context Adding a second value "solves" the problem, but I think it should be possible to update just one value... Thank you for the action :)

dive-deeper avatar Feb 24 '24 23:02 dive-deeper

I tested a little more and it seems it does take some single values but others not. For example it does take a function like the one you mentioned in issue #371. A random string also works e.g. [[ "test" ]]. However ints or numbers in strings e.g. [[ 42 ]] or [[ "42" ]] won't work.

Browsing through the google api python client docs I noticed it said null values would be ignored. Seems to be the case here as well. So something like [[ 42, null ]] works and doesn't seem to have any side effects. My problem is thereby solved with a slight workaround but this still seems like a bug to me :)

dive-deeper avatar Feb 25 '24 15:02 dive-deeper