Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save glureau/833d83099cb74efc937f9afddba2cca4 to your computer and use it in GitHub Desktop.
Save glureau/833d83099cb74efc937f9afddba2cca4 to your computer and use it in GitHub Desktop.
@mrienstra
Copy link

Line 10:

var args = formula.match(/=\w+\((.*)\)/i);

... Limits the use of this function. I changed it to:

var args = formula.match(/\blinkURL\((.+?)\)/);

... so that it supports more complex use cases.

@mfuse-xx
Copy link

mfuse-xx commented Jan 20, 2023

Trying this, but getting an error;

TypeError: Cannot read properties of null (reading '1') (line 15).

@mrienstra
Copy link

Trying this, but getting an error;

TypeError: Cannot read properties of null (reading '1') (line 15).

@mfuse-xx, Looks like args is null, so line 10 isn't matching as expected. Hard to debug further without seeing the spreadsheet. You can try changing line 10 to:

var args = formula.match(/\blinkURL\((.+?)\)/);

... And see if that helps.

@theweeklytea
Copy link

Trying this, but getting an error;
TypeError: Cannot read properties of null (reading '1') (line 15).

@mfuse-xx, Looks like args is null, so line 10 isn't matching as expected. Hard to debug further without seeing the spreadsheet. You can try changing line 10 to:

var args = formula.match(/\blinkURL\((.+?)\)/);

... And see if that helps.

Hi @mrienstra also tried the code and changed line 10 to var args = formula.match(/\blinkURL\((.+?)\)/);

but still getting the same error :(
TypeError: Cannot read properties of null (reading '1') (line 15).

@mrienstra
Copy link

@mfuse-xx, @theweeklytea, if either of you can reproduce the problem in a spreadsheet you're willing to share, I'll take a look & see if I can figure out what's going wrong.

@thdoan
Copy link

thdoan commented Feb 6, 2023

Were you planning to use urls array for something? If not, you can remove it :).

@Marc-Girondot
Copy link

I cannot use the result of this function as a parameter of IMPORTRANGE. It works in two steps:
For example in the cell E25 I have a link.
With =linkURL(E25), I get the link, for example in E26 and then with
=IMPORTRANGE(E26; ADDRESS(72;1))
I get the correct result.
But with
=IMPORTRANGE(linkURL(E25); ADDRESS(72;1))
I get
#ERROR !
Any idea why ?
Thanks
Marc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment