a-marenkov / gsheets

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

allrow is not refreshing new rows #26

Closed FarsFuad closed 4 years ago

FarsFuad commented 4 years ago

There is a problem where when i call for refresh , allrows method brings me the same rows the i got.

here is the code.

List rows = await gSheet.sheet.values.allRows(fromRow: 2); print(rows.length);

try to insert new row to the google sheet and u will not get the new row or the list length right.

FarsFuad commented 4 years ago

I found the error, its because the 'allrows' method gets the length of the worksheet rows , one time only, and it never update its length , unless u uninstall the app and reinstall it again , or try hot restart button , and the only way to avoid it now , is to add 1000 empty rows and hope the user doesn't reach 1000 rows by the time.

so can u please sir make the 'allrows' updates its length every time it runs like other method do !

'row' & 'column' ...

and thanks for your time <3

Amazing Pug <3

FarsFuad commented 4 years ago

تعليق توضيحي 2020-07-23 082059

Here u can see, the 'allrows' method length will always stay 2 , and never updates again, even if u add new empty row to the worksheet.

FarsFuad commented 4 years ago

تعليق توضيحي 2020-07-23 082256

And here , u have the limit of 1000 rows , before the user most reinstall the app to fix it.

a-marenkov commented 4 years ago

Hi @FarsFuad

Thanks for feedback, I'm looking into it right now.

a-marenkov commented 4 years ago

@FarsFuad I rolled out pre-release version that fixes it, can you please check and let me know if it solved:

dependencies:
  gsheets: ^0.2.5-dev.1

Regarding refresh method - i think it was not clear how it works so i refactored it.

Before you should be doing:

  // getting worksheet
  var sheet = ss.worksheetByTitle('example');
  // refreshing
  await ss.refresh();
  // getting refreshed worksheet
  sheet = ss.worksheetByTitle('example');

Now you should be doing:

  // getting worksheet
  var sheet = ss.worksheetByTitle('example');
  // refreshing
  await ss.refresh();
  // that's it, sheet is refreshed as well
FarsFuad commented 4 years ago

hey , thanks for the reply Alright , let me check it out

Thanks !

FarsFuad commented 4 years ago

Fixed ! Thank you very much sir , now i can work with allrows without any problems <3 Hope u the best <3

And i will like to see more features coming to this pub ! Good Luck <3