a-marenkov / gsheets

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

How to add a new row/column to the end of the table? #1

Closed Gibitop closed 4 years ago

Gibitop commented 4 years ago

Google sheets have a limited amount of rows and columns. So when you run out of that amount, you just add new row/columns. Even though GSheets has insertRow and insertColumn functions, they only work inside the given dimensions and it would be really useful to be able to widen the table when needed with just one function call. I see two ways in which this can be accomplished:

  1. Add new functions, that create a given amount of rows/columns outside of the current dimensions of the table appendCol(int amount) { ... } and appendRow(int amount) { ... }
  2. When the insertValue function is called, it creates needed space if the coordinates are outside of working range
a-marenkov commented 4 years ago

Google sheets have a limited amount of rows and columns. So when you run out of that amount, you just add new row/columns. Even though GSheets has insertRow and insertColumn functions, they only work inside the given dimensions and it would be really useful to be able to widen the table when needed with just one function call. I see two ways in which this can be accomplished:

  1. Add new functions, that create a given amount of rows/columns outside of the current dimensions of the table appendCol(int amount) { ... } and appendRow(int amount) { ... }
  2. When the insertValue function is called, it creates needed space if the coordinates are outside of working range

Hi! Thanks for checking out GSheets library and providing your feedback!

Speaking of Worksheet's isertRow and insertColumn methods - these methods are used to add new rows/columns in the middle of a sheet (so they should be inside current bounds).

Speaking of expanding sheets size - i believe that working with google sheets programmaticaly you should't really care about current row/column count, checking if there is enough space for inserting values and add space if not (with a method call). For that matter i made all methods that insert actual values into sheets with this «check» built in. Such methods would expand current sheet size to meet inserting range prior to insertion. It's my bad i didn't specified that in the docs.

You can also expand sheets size by requesting values out of its current bounds.

Can you please check and let me know if that works for you.

About your suggestion to add methods for appending rows/columns - i think it would be handy to have them, i'll add them in future release and let you know.

Thanks!

a-marenkov commented 4 years ago

Added method you suggested in dev.5 version - see here

Gibitop commented 4 years ago

Thank you, I'll check it out shortly and let you know

a-marenkov commented 4 years ago

Consider this issue closed.