Google spreadsheet CTRL+Shift+E - google-sheets

I have spreadsheet with two sheets: current_sheet and archive_sheet.
I also have a script (which I created) which removes data from current_sheet and appends it to archive_sheet once per month.
The sheets have an arrayFormula, and after every monthly move operation, cells with this arrayFormula wind up without any results - and I receive a warning message, indicating that I should press Ctrl+Shift+E in order to resolve the problem.
Once I've done so - the formulas work again. What I'm wondering is... how can I alter my script so that I don't have to provide this manual fix every month?

use a time driven trigger to run your script each month

Instead of using script to move your data each month, try copying the values, then clearing the original data and reinitialise the formula. Without seeing your formula and have a clear understanding of what your doing, im kinda punching in the dark.

Related

How to make Google Sheet arrayformula work with date functions

I have a column of dates with the format "yyyy-mm-dd". And I want to do summary statistics by month -- using native formulas.
When I put arrayformula around month(...)>month(...), I get the error
Result was not expanded automatically, please insert more rows (1).
Why is that? And how do I get around that?
Example sheet. Formula in B4.
=arrayformula(month(B4:B)>month(B3:B))
Note: I don't know the number of rows ahead of time -- it is expected to update from time to time.
Firstly, erase your formula, it is trying to automatically expand the sheet and the sheet already has over 50,000 rows.
Next delete 48,000 rows or so.
Next put this formula in cell B4:
=arrayformula(month(B4:B)>month(arrayconstrain(B3:B,rows(B4:B),1)))
That will prevent the formula from auto-expanding the sheet.
That should work, though I think you're going to realize you don't like what happens when the year changes. I believe this to be an xyProblem.
=arrayformula(if(isblank(B4:B),,month(B5:B)>month(B4:B)))
works.
It seems it is always better to include an isblank() wrap to avoid indefinite expansion of the sheet.

Google Sheets IMPORTRANGE and QUERY not refreshing

I have been using IMPORTRANGE and QUERY extensively to connect all of my spreadsheets for a while now. But recently noticed that IMPORTRANGE and QUERY will not return proper data unless the source Sheet is open. Also, the data used to automatically update (every 30 min or so, whatever the default refresh rate is) in the background for IMPORTRANGE, but now it will only update if I manually open the Sheet and it will display "Loading...." before returning the data.
Is anybody else having issues with these two functions?
This answer explains the issue you encountered.
In summary:
It doesn't update when the sheet isn't opened.
Recalculation only happens when sheet is opened.
Functions that pull data from outside the spreadsheet recalculate at the following times:
ImportRange: 30 minutes
ImportHtml, ImportFeed, ImportData, ImportXml: 1 hour
GoogleFinance: may be delayed up to 20 minutes
Alternative solution:
You can use time driven triggers and update those values every N minutes/hours instead BUT you will have to create a script for that.
Everytime you trigger, you'd have to use setFormula on every cell you used your importrange and query.
References:
setFormula
Choose how often formulas calculate
Time Driven Triggers

How Can I Set a Formula to Only Update Once

I'm collecting Google Form responses in a sheet, and merging over a variable to keep track of who in my roster has responded.
My issue is I'm having to bring the Form responses into the current sheet with IMPORTRANGE, and everyone once and a while, that formula inexplicably returns
"#REF! Import Range Internal Error"
for up to a few hours before correcting itself. This means my completion tracking isn't working at that time.
Is there a way to set a simple function like =A2 to only update when text is added, and not if it disappears?
I want a sheet to contain the data in the imported range and add to it as more form responses come in, but also keep all the data if the imported range disappears.
just put your IMPORTRANGE formula into IFERROR eg:
=IFERROR(IMPORTRANGE("ID", "Sheet1:A1:B"))
this way you will get either values you need or nothing till #REF! disappears.

"Unresolved Sheet Name" errors randomly shown across my cells

This started happening to me today, almost randomly my functions show "Unresolved Sheet Name". I have to go into the function, as if I was editing it, and just hit Enter and it works like normal. The issues is I have thousands of functions across several sheets and they keep intermittently "breaking" on their own terms.
This is similar to: Google Spreadsheet Import Range #REF! Error (Randomly).
I have a spreadsheet holding a large chunk of data which I import to the current spreadsheet I'm using. I then reference the worksheet I used to importrange the data into. The reference to that worksheet will intermittently break.
I see no reason to paste my functions, since they do work as long as this #REF error does not show up.
Is this a known bug?
I've had this happen before in the past, and eventually resolved to just "refresh" all my functions every time this happened. In this case, the spreadsheets are client facing and need to be reliable so I don't have that option.
Any way to "refresh" all my functions without going through them one at a time?
I had a similar issue that I corrected with script. My spreadsheet references sheets that aren't yet created. This results in a "ref" error as expected. However, when I create the sheet, the "ref" error only goes away when I click in the cell and then hit "enter."
Since I had already written a script to update my sheet monthly, I added the following to the end (I only needed to update 12 cells, hence the range):
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Random Notes/Calcs");
var formies = ss.getRange(31, 24, 12, 1).getFormulas();
ss.getRange(31, 24, 12, 1).setFormulas(formies);
In summary, get your range, then get the formulas, and then set the formulas to the same range. I'm sure there is a better way. Hope this helps.
I have some time working with google sheets, the issue I've have is in the Import Range #REF! Error (Randomly)
Fine, the solution I found is using the ** RANDBETWEEN** and MOD
Try this
=IF(MOD(RANDBETWEEN(0,10),2)=0,IMPORTRANGE("SheetID","Sheet!a:Ab"),IMPORTRANGE("SheetID","Sheet!A:Ab"))
With the Changes, the rand formula will recalculate the number. If you see, the Range of the sheet change A by a.

Google Spreadsheet Import Range #REF! Error (Randomly)

This problem has been persistent for a while, just happens every so often at random times, nothing changing. I also do not know how to reproduce the problem, but I'll give a detailed explanation of what's happening.
Normally the importRange function works just fine, and looks something like the following:
The Spreadsheet key is typed correctly - I've been using this strategy in Google Spreadsheets for a while now.
Every so often, Google Spreadsheets seems to break down, or at least the importRange function does... and produces something like the following:
Google seemed to be freezing up at times today, which is when this happened. I've tried adjusting the importRange parameters to !X1:X, !X2:X5, changing the title of the Sheet that is being imported, etc.
In the past, changing from !X:X to !X1:X fixed some columns, but not always all of them. The only fool-proof solution to fixing this, that I have found, is recreating both spreadsheets. As the back-end (the one being imported) eventually becomes a report, I would like to spare my boss the extra effort of referencing multiple spreadsheets, and would rather just fix this and be done with it.
Does anyone know the potential cause of this glitch? Sometimes it fixes itself, sometimes it doesn't. It happens randomly, and only to certain spreadsheets (I have a set of 8 or so that all use importRange, and no more than 2 are ever affected at the same time). So I honestly have no clue where this is coming from.
Side note: Google in general has been a bit unresponsive today in terms of all its services - my university's App Engine email service was down for about half an hour. Could a limitation on resources/network attackers be causing this kind of behavior in Spreadsheets?
Update: I attempted to import to the same Spreadsheet data from a different Spreadsheet (i.e., gave the importRange function a different Spreadsheet key). Though the key and range are valid if imported into a different Spreadsheet, in my original (the one full of #REF!), that range is not imported correctly. This leads me to believe that this glitch may apply only to a single Spreadsheet, where any attempt to importRange from any other source is not functional.
This is a little late, but I came across it in a search so it might help someone else - try something like this:
=IFERROR(ImportRange(SpreadSheet_GUID,"Bookings!P:P"),
IFERROR(ImportRange(SpreadSheet_GUID,"Bookings!P:p"),
IFERROR(ImportRange(SpreadSheet_GUID,"Bookings!p:P"),
ImportRange(SpreadSheet_GUID,"Bookings!p:p"))))
Basically the idea is to force Google to recalc using variations of the original address (upper/lower case column letters).
The problems with the IMPORTRANGE() function has been somewhat of an ongoing issue. There have been several bugs over the years and it is up to Google to find a stable solution so it works as designed.
Until then, this might help you:
Instead of editing the cell, creating a new spreadsheet, or doing anything else to have the sheet reattempt the function (almost like playing lottery), you can force Google sheets to reattempt the function automatically when it fails to load:
Wrap the IMPORTRANGE() function that is causing problems with an IFERROR() function. That way, the sheet attempts the import, and only if it fails, it attempts it again. The function can be nested to attempt several times in a row.
You can add named ranges to your source data (right-click-source>define-named-range) to facilitate. For instance, you can create 3 different named ranges for the "J:J" range. Call them "J", "Ja", and "Jay", then you call on your IFERROR() function in the sheet you want to import to:
=IFERROR( IMPORTRANGE( "SheetID","J" ), IFERROR( IMPORTRANGE( "SheetID","Ja" ), IFERROR( IMPORTRANGE( "SheetID","Jay" ), IFERROR( IMPORTRANGE( "SheetID", "'TabName'!J:J" ), IFERROR( IMPORTRANGE( "SheetID", "'TabName'!j:j" )))))
This formula will attempt your import and deliver it if it succeeds, and if not reattempts a total of 5 times in a row automatically, which doesn't guarantee you will succeed, but if you have a 50% chance of success with your imports, nesting 5 in a row should give you a 96% chance, which is a lot better. My personal experience has been that it hasn't failed since I've done the IFERROR() nest.
Hope it helps.
I had similar issues, and were resolved by NOT using public links to spreadsheets.
I have noticed that links are different for public sharing and those coppied from address bar while sheet si opened.
Also i have noticed some difficulties while opening shared spreadsheets from my other Google accounts. I had to re-allow access for some spreadsheets that i was importing.
Sorry for my english.
This happens, indeed, in my case simply Ctrl+X, waiting for a second, and then pasting the formula back makes the Sheets engine re-do the import and then it succeeds to import.
In case you can not do this procedure manually, you should use Tim's solution.
I found this solution, work fine for me:
In both spreadsheets insert an =now() equation in a random cell, say Z1
In both spreadsheets insert an =importrange() function that references the now function of the other spreadsheet.
Go into your spreadsheet settings and choose to recalculate every minute.
I tried a lot of other suggestions including using the =now() function, the now URL trick in this thread, or Apps Script to insert random text on a set interval, but nothing would force importrange to update except a manual edit of the source sheet.
https://webapps.stackexchange.com/questions/60324/how-can-i-get-google-sheets-to-auto-update-a-reference-to-another-sheet
I had the same issue, and found a solution!
Please reduce the source file's size
To reduce, split it up and again have the import-range referenced
You now will be able to see the imported range!
If you think the above isn't the situation, the chances might be
Your cell is occupied so remove all formatting and clear all the cells before importing the range.
Still not working? Let God help you out!
I tried adding :
if(ISERROR(importrange...
and it works.
It doesn't mean the error disappears, but when it happens, you just need to reload the sheet and wait for while and let it update itself.
It is much more practical than manually changing the big letter to small letter.
Here's the easy work-around I've found for this bug:
I do a Find-and-Replace ("search within formulas") for "=" wherever I have the importrange error (=REF!) (or just for the whole sheet) and I replace-all with a "#" in order to make it all be text rather than formula. Then I do another Find-and-Replace over the same area and replace-all the "#" with "=" again. This consistently fixes the issue.
I was able to fix the =REF! error using the Edit > Find and Replace > Find "=" Replace with "#" > Search Selected Range > Also search within formulas > Find > Done. The error corrected without actually initiating the Replace command.
just to share with you how I resolve this error.
Upon checking on my formulas, I have a Circular Reference, which made me encounter this ImportRange internal Error. When I clean my formulas to remove those circular references, it worked again. :)
I had the same problem and solved it by using
=IF(ISERROR(A1);IMPORTRANGE();IMPORTRANGE())
in the cell where earlier IMPORTRANGE used to be and by turning on Iterative calculation in spreadsheet’s location & calculation settings.
Hope it help someone

Resources