-1

I want to insert a blob object (.jpg image) with Google Sheets API.

Does Google Sheets API allow for blobs inside the spreadsheet's cells?

I know that inserting the image directly into the spreadsheet by hand without using API is possible.

Łukasz D. Tulikowski
  • 1,440
  • 1
  • 17
  • 36
  • Does this answer your question? [Insert image into Google Sheets cell using Google Sheets API](https://stackoverflow.com/questions/43664483/insert-image-into-google-sheets-cell-using-google-sheets-api) – Emel Oct 24 '22 at 07:35
  • @Emel The thread you mentioned is not directly related to my question. – Łukasz D. Tulikowski Oct 25 '22 at 12:34

1 Answers1

1

In the current stage, unfortunately, the image blob cannot be directly put into Google Spreadsheet using Sheets API. So, it is required to use the workarounds. In this answer, I would like to propose the 2 workarounds for achieving your goal.

Pattern 1:

In this pattern, IMAGE of the built-in function of Google Spreadsheet is used. The flow is as follows.

  1. Upload the image to Google Drive using Drive API.
  2. Share publicly the uploaded image using Drive API and receive the URL of the image.
  3. Put a function of =IMAGE("URL") to a cell using Sheets API.

By this flow, your goal is achieved. If you can know the direct link of the image, you can directly use only the 3rd flow of the above flow.

Pattern 2:

In this pattern, the image is inserted into the Spreadsheet using Web Apps created by Google Apps Script.

  1. Upload the image to Google Drive using Web Apps.
  2. Put the image blob into the Spreadsheet using Web Apps.

By this flow, your goal is achieved.

References:

Tanaike
  • 181,128
  • 11
  • 97
  • 165