Are there any limitations for number of cells that can be updated/fetched at once using google spreadsheet API? - google-sheets-api

Are there any limitations for number of cells that can be updated/fetched at once using google spreadsheet API?
I can find the limitation of number of API calls in the page below, But I cannot find number of cells limitation on updating/fetching.
https://developers.google.com/sheets/api/limits
If there are some documentation about that, I would appreciate it if you could tell me.

About Are there any limitations for a number of cells that can be updated/fetched at once using google spreadsheet API?, in the current stage, I cannot confirm the clear limitation value. But, I thought that the following information might be useful for understanding your question.
Experiment:
In the current specification, 10,000,000 cells can be used in a Google Spreadsheet. Using this, I have tested to embed 10,000,000 cells as all different values using a sheet with 10 columns x 1,000,000 rows. Ref The result is as follows.
About retrieving values from cells Ref
When the values are retrieved from 10,000,000 cells using one call of Sheets API, it was found that this cannot be done. As the result, the values retrieved from 200,000 cells can be achieved by one API call. But when the number of cells is increased by more than 200,000 cells, an error like response too large sometimes occurred. But, I'm not sure whether 200,000 cells is the maximum limitation number. When I tested more than 200,000 cells, there was in the case of no error. But, in this case, there was the case of an error. When the value of a cell is long, the limitation has been changed from 200,000 to smaller. So, I guessed that this limitation might depend on the size of all response data from Sheets API.
About putting values to cells Ref
When 10,000,000 cells are embedded by all different values using one call of Sheets API, it was found that this cannot be done. As the result, 200,000 cells can be updated by one API call. But when the number of cells is increased by more than 200,000 cells, an error like API call to sheets.spreadsheets.values.update failed with error: Empty response sometimes occurred. But, I'm not sure whether 200,000 cells is the maximum limitation number. When I tested 300,000 cells, there was in the case of no error. But, in this case, there was the case of an error. So, I guessed that this error of API call to sheets.spreadsheets.values.update failed with error: Empty response might not be the maximum limitation number for processing cells.
Note:
This is the result on 25 Apr 2022 that I investigated. So, by the future update on the Google side, I think that this situation might be changed. I would like to believe that the future update brings better change from the current situation.
Reference:
Report: Handling 10,000,000 cells in Google Spreadsheet using Google Apps Script

Related

Add A Row - Not adding a row to bottom when previous rows are hidden

I have an order form (hosted by Jotform.com) that's connected to a Google Sheet via the API through a company called Integromat.com. Everything has worked great for years but I received an email from Integromat.com on Friday that we were using a legacy version of the Google Sheets module and we needed to update before that legacy version stopped working.
I updated our modules (which I assume just updates the Google Sheets API?) and now I'm encountering a problem that I'm not sure how to fix. Integromat is claiming that "Unfortunately this behavior comes directly from Google Sheet's and we can't avoid it." but I question that.
My problem: The sheet that receives the order form data is updated properly so long as the very last row of filled data is unhidden. But we hide rows as orders are completed and if all the rows are hidden and a new order comes in a row is added at the top of the Sheet (row 2 since we have a header that's never hidden in row 1) which in turn throws off several other Sheets that are connected to the order sheet.
Before the update, the add a row function didn't care if rows were hidden or not. But since the update it's like it can't tell if data is contained in hidden rows or not and just proceeds to insert a new row at the top.
Is Integromat correct that this is now unavoidable? Or is there a solution that I can implement or tell them to implement?
The workaround for now will be that we don't hide orders in that sheet but that's not a great long-term solution for us.
The problem can be caused by the first cell of the caption. It seems like integromat (aka make) can't handle it and thinks there is no caption. Then it just adds the new entry as the first line. Once the very first cell in the title contains data, it should work again.

How do I prevent unlocked cells from being selected/editable? (VBA)

I have a very specific question that I am looking for help in answering. I have been researching for hours and I feel like I am not able to find what I am looking for. Below is a quick overview of the criteria that my document must follow:
I am using Excel 2013
I will just be using rows for data input (instead of an excel object
table).
The very top/first row will act as my "column header".
This top row will have AutoFilter enabled.
THE DOCUMENT MUST BE PROTECTED (a must-have)!
I will be using VBA code
Now, the final issue I am having with finishing this document are the last two criteria points that I must have:
The first/top row (column headers) must NOT BE EDITABLE.
Each column must be able to SORT AND FILTER.
Now, in a perfect world, I would just "Lock Cells" for the entire first row that acts as my column headers and when I protect the worksheet I would make sure to check the "Sort" and "Use AutoFilter" boxes.
However, this option does not work because there seems to be an issue when I try to sort the data. If I just filter the data there is no problem, but when I try to sort a column in ascending/descending order I will get an error informing me that I can't sort locked cells while in Protected mode. This is because when excel uses the Sort function, it counts the header as part of the data that is being sorted (I found this out through my research) even though I really just want the data below it to be sorted.
I have been trying to brainstorm on how to get past this issue as well as researching different methods, and I am having trouble coming to a final conclusion. However I have narrowed it down to 2 possible solutions:
I want to be able to keep the cells in the first row officially unlocked to allow the AutoFilter's sort command to work as intended, but make it "behave" like the cells are locked when a user tries to make changes to it (AKA, make the entire row un-editable or un-selectable).
The other option would be to keep the first row locked but somehow have an event in VBA that can tell when a user tries to "Sort" the column, which will then temporarily unprotect the worksheet, follow through with the intended sort command, then protect the worksheet again (apparently though, upon my research there is no such event that can trigger off the AutoFilter's sort command alone).
These 2 solutions are the most logical I can think of based off my research, but if someone out there is an Excel genius and knows another way I am open to suggestions.
Thanks in advance for your help/suggestions,
Travo
Consider using two header rows. The top row would be protected and the second row would facilitate filtering and sorting of the data in rows 3 and below.

Unable to move / delete rows in shared workbook - Not enough resources

this one's a bit of a painful one so thank you for your help and patience with me.
We have an Excel spreadsheet that we use as a master file for our website products. As such there are quite a few sheets and quite a few products on each running along side some macros to provide some extra functionality (turning entered data into HTML for product page, etc).
My issue is that one of our most used spreadsheets has become a trouble in that it has some phantom formatting all the way down to the millionth-and-something row and all the way across, causing the last cell to be the very last cell possible.
The issue that has finally popped up as a result is that we can no longer move rows in, out or around the sheet (a required functionality) as it results in an 'out of resources error'.
I've tried:
Highlight all rows below used range to right-click> delete - Results in runtime error (from macro)
Highlighting large chunks of rows and using Clear All - Resulted in the 38MB file bloating to 380MB
Deleting a chunk of rows at a time - Maxed out at 1,000 before it caused Excel to crash
Moving to new spreadsheet - Broke all our macros (which I did not write and am not proficient enough to fix on a new sheet)
Disabling macros and trying the above options, only marginally more efficient but still out of resources
I'm at my wits end on this one and, while we can continue with most day-to-day functions, we will soon be completely unable to use this particular sheet as we need it at all.
I'm wondering if there might be a way to run a VBA script to remove these rows, potentially one by one? I've tried running a short script that went something like rows[960,1000000].Delete (forgive my terrible VBA markup), but this also resulted in not enough resources errors.
I'm wondering if there's anything like:
row = 960;
while(row<=1048576){row.Delete};
Continuing, the runtime error debug points me to the below if statement within the macro:
If Target.Count > 1 Then Exit Sub
Where Target is the variable passed to the sub.
Which strikes me as very odd because my (limited) understanding of VBA and IF's in general simply recognizes that 'if my selection is larger than 1 (row?), do not run this code..
Thanks again in advance.
Use this method only if you don't have any links into or out of the sheet that will get broken. Also might have Sql connections that might get broken. Might need to disable macros. There are many possible problems with this approach. Use at your own risk.
Note the exact "Name" and "(Name)" of the sheet; Look in the VBA code window at the properties for the sheet. "Name" is the name displayed on the worksheet tab. "(Name)" is the code name visible only in the properties window.
Make a list of range names on the sheet.
Copy the data to a new sheet.
Copy any macros to the new sheet.
Delete the old sheet.
Rename the "Name" and "(Name)" of the new sheet the same as the old one.
Recreate range names.
A better method if you don't have too many formats:
Disable macros and set calculation to manual. This avoids recalculating while doing your delete operation.
Select entire sheet and clear formats.
Delete all rows below your data.
Redo your formatting. Select entire column (not just used area) to apply format if applicable.
It is important to remove formatting on the entire sheet from A1 to the end. Otherwise you'll get the bloat you mentioned. Just that step may solve your problem. If not then proceed with removing all the rows below the data. This should not cause file size bloat.

VBA to transfer a figure from one sheet to another based on matching values other col

I am working on a spreadsheet which is being used to transfer a product from one location to another. Each day I will have a new list of products that needs sending to another location and I already have a "pre-populated" sheet that has suitable locations listed for where these products can be sent to.
I've already worked out the formula's to use which defines the location these products can be sent to (through index and match formula) but once this has been completed, I'd like to update the "pre-populated" sheet with the quantity I'm sending these locations so that limits can be deducted accordingly.
Essentially, I want to copy the figure from column G in ("Task") into column I in ("interstore transfer") where the two "REF" columns in either sheet match. The "New Limit" column will then automatically populate with the new limit based on the figure input into Column I. Once its finished working its way down the list in the sheet ("Task") then end.
I've had a rough attempt at this, but I'm coming stuck with defining the appropriate variables and how it should update.
Any ideas to better my approach would be appreciated.
A VBA solution with variables may not be your best approach for this. Variables declared within VBA code usually have a limited lifetime based on their scope, so when the code ends the values in the variable will be lost.
Another alternative may be to set aside another cell as a counter. Perhaps a good place for this would be next to the "New Limit" column?
Cell values are retained even when VBA code isn't running. Of course cell values also are saved when the workbook saves, so when you get a new list of products at the beginning of the day you can compare to or edit the previous day's work.
To get started with this, I'd recommend getting familiar with how to reference cells and ranges. And, there is some useful information here on Stack Overflow on how to reference well in Excel VBA.

Check values are the same within a certain time period

I have two workbooks with identical sheets and I need to test whether the data they are getting (from different sources) is identical or within a certain threshold. This, I am already able to do fine. I create a third workbook which calculates the difference between the two.
However, the issue is that one workbook updates seconds before the second which means that if a cell gets two quick updates my calculations would lag behind.
So what I was thinking is that I make a note of the cell value in workbook 1 (the faster updating workbook) and if at anytime up to x seconds after workbook 2 cell has the same value as noted, they are good.
...but how would I go about this, is VBA even the best tool for this?
Any ideas?
using timestamps and vba - or maybe even conditional formatting and some good formulas - could solve this for sure.
However, without anything to work on, it is quite a big step to present you a solution.
Basically you would just create timestamps (internally as variables, or during the import process in cells) and then compare your values, after your threshold ran out. If the values of your compared cells still match, then it's ok.
However, this is all quite dependant on how you solved your dataimput and comparison.
My basic feeling, after I red your question was: "why wouldn't you just decrease your update rate of your calculation?"
Another idea: just use an indicator cell, switching between 1 and 0 or so, to indicate, if an update already happend - so, if you compare, you compare value+indicator. which is basically using timestamps without time.