googleworkspace / php-samples

PHP samples for Google Workspace APIs
Apache License 2.0
288 stars 348 forks source link

Inserting blank/space values in sheet changes the node for next row insertion #38

Closed Latiyan closed 5 years ago

Latiyan commented 5 years ago

I am trying to append some values in spreadsheet using google api php client.

I have successfully added data in the sheet but every time I run the code, it start appending values from column where the previous ended in the next row.

I am trying to append values in new row every time but it must start from column A.


Lets say I am inserting these values: array( array( "Item", '', "Ship Date" ) );

Now, when I run this code it appends "Item" on column A of a new row and "Ship Date" on column C. This is correct. But when I run the same code again, it appends the data in new row but starts with Column C and ends with column E. And so on.

I want the next time also the data should start appending from column A and ends on column C.


If you do not have blank/space values then the issue is not replicated, it works great. The issue is only replicated with blank/space values in my array.

Here is a screenshot of my test insertion: http://bakingcode.org/hitesh/2019-13-21-25.png

As a workaround first I am getting all the values from the sheet and then count it to get the last row, then make the range accordingly to append values starting from column A. But there can be a lot of data lets say in lakhs, then this will put unnecessary load on server.

I am also not getting any function to get the last row where data is present. Can you please help me in getting the last row or even better let me insert blank/space values and still the insertion starts with column A.

My specifications:

PHP version ( 7.2.14 ): OS ( Linux ):

sqrrrl commented 5 years ago

Hi,

Thanks for inquiring. Unfortunately this issue tracker is only for bugs related to the the samples. For general help about how to use the APIs, I suggest checking the support page for the sheets API. For general questions, Stack Overflow is the best way to get help.

If you do post to Stack Overflow, be sure to include additional details and the code that you're using. Without that, it's hard to say why you're seeing the behavior described.

Closing this issue as it's not the appropriate forum.