How to update worksheet range if address contains special characters? - microsoft-graph-api

I am trying to update range using /workbook/worksheets/{id|name}/range(address='<address>') request from https://learn.microsoft.com/en-us/graph/api/range-update?view=graph-rest-1.0&tabs=http. In my case document contains two sheets with names 'invoice' and 'invoice-lines'. Cell's to update address is 'invoice-lines'!$B$5 in second sheet. Address I get from API using GET /workbook/worksheets/{id|name}/names request.
My request with address example:
https://graph.microsoft.com/v1.0/groups/{group-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address=''invoice-lines'!$B$5')
I expect result the same as I get when updating range in sheet 'invoice' with request https://graph.microsoft.com/v1.0/groups/{group-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets/{worksheet-id}/range(address='invoice!$B$5'),
but actual result is 400 Error with message "Syntax error at position 18 in 'address=''invoice-lines'!$B$5''."
I tried encode URL and remove quotes. Without quotes in address I get error The argument is invalid or missing or has an incorrect format.
How my request should look like to update this range?

Related

Error Invalid call to non-function in google sheets

I have this Google Sheet file using this formula to split and flatten the input in B2:B3
=ArrayFormula(LAMBDA(sp, FLATTEN(SPLIT(sp, "♥"))))(BYROW(A2:A3, LAMBDA(rp, REPT(B2:B3&"♥",rp))))
I encounterd this error
Error
Invalid call to non-function.
What is it and How to solve it?
The error that you have received will mean that the formula was not able to call the parameter that your function was expecting, checking both of the 2 formulas that you have made:
LAMBDA(sp, FLATTEN(SPLIT(sp, "♥")))
And
LAMBDA(rp, REPT(B2:B3&"♥",rp))
Both of them are calling a range being this part of the formula expression however there is no really a valid value to be passed to the expression so it can "call it" to provide the result.
In a nutshell, the error "Invalid call to a non function" means that in your formula you have put the call parentheses "()" which contains the data that will be called to the function that you have named but this data can't be called.
An example of this error can be made with the following LAMBDA formula:
=LAMBDA(test, test())(A1)
Using this formula will display the same exact error and this is due to the parameter being "called" it's invalid, this is due to the data being called a range and not a valid function.
You can try this formula for lambda approach.
=LAMBDA(Rpt,Rpn,QUERY(INDEX(FLATTEN(SPLIT(REPT(Rpt&"♥",Rpn),"♥"))),"where Col1 is not null"))(B2:B3,A2:A3)
Without lambda-
=QUERY(INDEX(FLATTEN(SPLIT(REPT(B2:B3&"♥",A2:A3),"♥"))),"where Col1 is not null")
I think the issue is that you are calling a vertical range B2:B3 from within the internal LAMBDA that is not defined as part of the range to be passed to it from the BYROW that is calling it. I think a MAP would be more appropriate than the BYROW in this case as you can then feed multiple ranges into the LAMBDA it calls:
=arrayformula(lambda(flt,filter(flt,flt<>""))(lambda(sp,flatten(split(sp,"|")))(map(A2:A3,B2:B3,lambda(a,b,rept(b&"|",a))))))
N.B. - The additional outer lambda is required to filter out the empty cells that will occur when sp is flattened if the numbers of repeats in B2:B3 is not the same (as jagged arrays aren't allowed). This could obviously also be done with a QUERY, but here is one way of doing it with LAMBDAs all the way through.

Why do I get syntax error when using DateAdd

I am using the following expression in the Criteria section of an Access Query
<DateAdd("m", -3, Date() )
I have tried it with quotes and hash characters etc but every time I get
"The expression you entered contains invalid syntax"
I have aslo used the expression builder with the same results.
Any ideas.

How to fix error: 'Array result was not expanded because it would overwrite data in __'

I set up this spreadsheet to take attendance over Zoom each Am with my students. Students fill out a Google Form to check in. Their data goes into a connected spreadsheet, which in turn goes into a sheet displaying student attendance.
Prior to any student data being entered, the cells in rows 3-6 have an error message:
Error: Query completed with an empty output.
Then when a student name populates one of these cells, the following message appears:
Error: Array result was not expanded because it would overwrite data in G3.
What I want to happen is for a student name to be displayed (complete with conditional formatting).
Here's a link to the spreadsheet: https://docs.google.com/spreadsheets/d/1DpERPaq8yIwDKHkp4T463D6GL5WHAVwHAVYqGmHNJxQ/edit?usp=sharing
The syntax of your query should be corrected.
Please use queries using the following pattern:
=query(FormResponses2!D2:G, "select D Where D is not null and D contains 'Anh'")
(Please adjust ranges to your needs)
Functions used:
QUERY
One of the the I discovered with this #REF error is that if you are looking up by date and have duplicate values of the same date you are looking for in the lookup data, then you will encounter the same error.

Blank vs #REF response to INDEXing QUERY search

I'm making an analytic sheet in Google Spreadsheets and am using the QUERY function bundled in an INDEX function. However, I'm encountering a weird error. Sometimes, when the query returns no response, it gives a #REF error, reading "Function INDEX parameter 2 value is 2. Valid values are between 0 and 1 inclusive." This makes sense to me, since there's nothing being returned. However, there are also some times that I don't get an error, and the function returns just a blank cell.
When I remove the INDEX portion of the function, both times (error and blank cell) read the same thing, which is just "sum FEE", ie the operation and column title. I'm also using IMPORTRANGE so the data portion of the query function is a little tricky, but just know that it's calling a variable name of the original spreadsheet.
Here are the functions from both error response and blank response.
Error: =index(QUERY(IMPORTRANGE(Ranges!$B$1,"'"&$A6&"'"&"!"&"A:O"), "Select sum(Col8) where Col3=''",1),2,0)
Blank: =index(QUERY(IMPORTRANGE(Ranges!$B$1,"'"&$A7&"'"&"!"&"A:O"), "Select sum(Col8) where Col3 is null",1),2,0)
try:
=IFERROR(INDEX(QUERY(IMPORTRANGE(Ranges!$B$1,"'"&$A6&"'"&"!"&"A:O"),
"select sum(Col8) where Col3=''", 1), 2, 0))

How to identify EXACTLY the error type in Google Sheets?

I have a spreadsheet which I need to import several data from other spreadsheets, So I have =importrange(<theOtherFile>,<cell>) in different places. But I have to go, one by one allowing access the first time my file is created.
What I want is to have an a different sheet a list with all the document references I link in the document. Over there, there is a list of all documents including Google Docs and Google Presentations. Then a script creates a =importrange() for each of them so I can, in one shot, press "Allow Access" once for each file (and the needed values pop up in the other places).
The problem is that in this huge list of importranges, I cannot tell apart #REF errors because I still don't have permission to collect data from the file or because the file is not a spreadsheet at all ("Spreadsheet cannot be found." error).
So, my question is: can I, beforehand, tell apart Google Sheets from other types of files so my script doesn't try to import them? If not; Can I somehow interact with the error message of a #REF error (this way I could write a formula that cleans the cell if the importrange() failed because the file is not a spreadsheet at all)?
=ERROR.TYPE(A1)
#NULL! 1
#DIV/0! 2
#VALUE! 3
#REF! 4
#NAME? 5
#NUM! 6
#N/A 7
#ERROR! 8
(no error) #N/A
if a cell has no error, the ERROR.TYPE gives an error. Use:
=IFERROR(ERROR.TYPE(B11);"No error")
Google Sheets offers only two functions to nullify the errors:
IFERROR - Returns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent.
IFNA - Returns the first argument if it is not an #N/A error value, otherwise returns the second argument if present, or a blank if the second argument is absent.
to analyze the error you can use:
ERROR.TYPE - Returns a number corresponding to the error value in a different cell.
ISREF - Checks whether a value is a valid cell reference.
ISNA - Checks whether a value is the error #N/A.
ISERR - Checks whether a value is an error other than #N/A
ISERROR - Checks whether a value is an error.

Resources