a-marenkov / gsheets

A Dart library for working with Google Sheets API.
Other
79 stars 31 forks source link

Get image from the cell #4

Closed pein95 closed 4 years ago

pein95 commented 4 years ago

There is an ability to insert images to the cells. Will be great if this lib can fetch this image.

a-marenkov commented 4 years ago

@pein95 Hi! Thanks for checking out gsheets library and providing your feedback!

I'm not sure that there's a way to get embedded in a cell image with Google Sheets API v4.

If you know, please let me know how or provide me with link to the documentation.

However, if you add images in cells with formulas, like following:

=image("https://dart.dev/assets/shared/dart/logo+text/horizontal/white-e71fb382ad5229792cc704b3ee7a88f8013e986d6e34f0956d89c453b454d0a5.svg")

It can be easily fetched. Here's a snippet: (lets assume that you have added formula into A1)

void main() async {
  final gsheets = GSheets(_credentials);
  final ss = await gsheets.spreadsheet(
    _spreadsheetId,
    render: ValueRenderOption.formula,
  );
  final sheet = await ss.worksheetByTitle('example');
  // prints the formula, link can be easily extracted
  print(await sheet.values.value(column: 1, row: 1));
}

Could you please let me know if it works for you.

Thanks!

piecubed commented 4 years ago

Haven't checked if this works yet, but images in cells could be a hyperlink

a-marenkov commented 4 years ago

Haven't checked if this works yet, but images in cells could be a hyperlink

Nice, it might be the way. I'll check later on today. Thanks!

a-marenkov commented 4 years ago

I checked a hyperlink and it didn't work, so i'm closing the issue since there's no known way to do that.