XLSX File in Rest API

Hi, I am currently trying to send an xlsx file that I have as a binary string through the rest api into a google sheet.


Currently I am trying to run this through the rest api but I get the error:

{"error":{"code":400,"message":"Invalid JSON payload received. Unexpected token.\nPK\u0003\u0004\u0014\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\n^","status":"INVALID_ARGUMENT"}}

Is it not possible to use a binary string of an xlsx file as data, or am I attempting this problem the wrong way?

Hi @Luke_Perez, this won't work. Why would you use a GSheet API if you're only appending data? Can't you decode and parse the xlsx file? This way of yours would be good if you're still passing it as an attachment to an email. I would recommend doing something like:

  1. Load/Read xlsx file
  2. Decode/Parse the binary string from the xlsx file
  3. (Optional) data manipulation to match destination sheet -- only do this if your xlsx file does not follow the same columns of the sheet destination
  4. Append using native Sheets resource in Retool

If you're going to use your GSheets API, then you have to follow the parameter they specified in this docu and step 3 above would be required step. The body only accepts majorDimension, range, and values.

If you can provide a screenshot of your sample xlsx file data and the destination sheet, I can be more specific.