Can't write with Google Sheets Plugin - JSON serializsation with datetime not possible

Options
cuezumo01
cuezumo01 Registered Posts: 2 ✭✭✭✭

Hi folks,

I've successfully set up the Google Sheets Plugin and it works smoothly, with one exception:
I can't write data with date format to any google sheet.

The error notification says "Job failed: Error in Python process: At line 69: <class 'TypeError'>: Object of type 'datetime' is not JSON serializable"

It doesn't matter which value interpretation I choose (RAW or USER-ENTERED), it fails with both.

Does anybody know how to solve this?
Would appreciate any hints.

Thanks,

cuezumo01

Answers

  • jereze
    jereze Alpha Tester, Dataiker Alumni Posts: 190 ✭✭✭✭✭✭✭✭
    Options

    Hi Richard,

    Thank you for reporting the issue.
    I can confirm this is a bug. I documented it on the github repo. We will address it in a later release of the plugin.

    Meanwhile, I can suggest two workarounds:

    1. You can convert the type of the column to "String", for example using the prepare recipe:

    Xnip2020-05-26_15-17-58.jpg

    2. Only the append recipe seems concerned. So if it fits your use case, you can also place a Google Sheets dataset as the ouput of a recipe and the spreadsheet will be cleared and receive a full copy of the dataset.

    Cheers,

  • cuezumo01
    cuezumo01 Registered Posts: 2 ✭✭✭✭
    Options

    Hi Jeremy,

    thanks for your reply.

    Yeah, I also thought of this simply work-around, it should serve most of the purposes.

    Are you sure about the write recipe? For me both the append and write recipes don't work with the date format. The same error pops up.


    best, cuezumo01

  • jereze
    jereze Alpha Tester, Dataiker Alumni Posts: 190 ✭✭✭✭✭✭✭✭
    Options

    Hi,

    We fixed the issue in version 1.1.1 of the plugin. For the append recipe.

    I was not able to reproduce the issue when using the Google Sheet dataset as the ouput of a recipe.

    Cheers,

Setup Info
    Tags
      Help me…