IMPORTDATA("https://min-api.cryptocompare.com/data/price?fsym=DOGE&tsyms=INR")
I have the above given function, and I have to call this function again with different parameters i.e. "DOGE" and "INR" will have to be replaced with a new set of parameters.
But I am not able to figure out how to reference cell within the url here.
Column_Reference The column which has to be iterated over looks like this.
I tried using cell reference directly, string manipulation but it didn't work as it didn't recognise it as a formula.
IMPORTDATA("https://min-api.cryptocompare.com/data/price?fsym=A2&tsyms=INR")
IMPORTDATA("https://min-api.cryptocompare.com/data/price?fsym=LEFT(A2,10)&tsyms=INR")
Please use this formula and drag down
=IMPORTDATA("https://min-api.cryptocompare.com/data/price?fsym="&B2&"&tsyms=INR")
Related
I have a list of cells that contain strings that were converted to links using CTRL+K
https://docs.google.com/spreadsheets/d/1Afshcs8f0A3CTeTPaudAhxZVYjMP22KY2gtLeu5qmAs/edit#gid=0
How can I retrieve the URLs in each of these cells?
If it was a formula (i.e. Hyperlink) I could use FormulaText to do so, but it doesn't work in this case.
You would need Apps Script for this
Specifically the getRichTextValue function:
let richText = cellRange.getRichTextValue();
let link = richText.getLinkUrl();
I did some experiments to see if it could be written as a custom function so that you could use it like any old formula, i.e. =getHyperlink(A1) however, when you pass in a range to a custom function, the value of the cell, the contents, gets passed to the function, not the address. There may be a funky workaround in this WebApps Exchange thread but depending on what you need it for, it may not be needed.
You could write a function like this:
function getHyperlink(cellReference) {
let file = SpreadsheetApp.getActive();
let sheet = file.getSheetByName("Sheet1");
let range = sheet.getRange(cellReference);
let richText = range.getRichTextValue();
let link = richText.getLinkUrl();
return link;
}
Which you could call from another function like this:
let aLink = getHyperlink("A1");
NOTE - the speech brackets around the cell reference.
If you use it as-is as a custom function, you would need to pass in the cell reference as TEXT (you would need to make sure you run the script once from the editor first, to ensure that it has been authorized).
EDIT:
Not sure why I didn't think of this earlier, but you could use this custom formula as-is in combination with =CELL, to make it work like a formula should.
=getHyperlink(CELL("address", A2))
Google Sheets allows to specify (hyper)links in two ways:
By using HYPERLINK formula/function, e.g. =HYPERLINK("http://example.com/", "Example.com")
By using "linking" feature – Insert » Insert Link
There are a lot of solutions around the web, and StackOverflow, for extracting URL from the first option - the HYPERLINK formula, but I haven't found any way how to extract it from the second option.
Example Sheet
How to extract with Apps Script a link URL inserted with Insert » Insert Link
Apps Script has a class https://developers.google.com/apps-script/reference/spreadsheet/rich-text-value that allows you to retrieve not only the plain text contained in a cell, but also its properties, such as the link URL.
To access this property use the method getRichTextValue() combined with getLinkUrl()
Sample to retrieve the link URL in a custom function:
function getLink(range){
var link = SpreadsheetApp.getActive().getActiveSheet().getRange(range).getRichTextValue().getLinkUrl();
return link;
}
After writing and saving this code, you simply need to call it from any cell, giving it the reference of the cell with the link URL as parameter.
Important:
Since it is the reference and not the value of the cell that should be passed to the function, you need to put the A1 notation in quotes.
Sample:
=getLink("A1")
We can improve ziganotschka's solution to avoid the need for quotation marks.
Enter this in B1 (assuming text with the embedded link is in A1):
=getLink(ADDRESS(row(),column(A1)))
This way it can be dragged down to quickly get data for an entire column.
If want to use like normal formula without quotation marks,
function GetURL(input) {
var formula = SpreadsheetApp.getActiveRange().getFormula();
var rx = /=geturl\((.*)\)/gi;
var rng_txt = rx.exec(formula)[1]
var rng = SpreadsheetApp.getActiveSheet().getRange(rng_txt);
return rng.getRichTextValue().getLinkUrl()
}
I'm trying to configure the C1 and C2 buttons in a custom DJI app. I found that I can call the method setCustomButtonTags:withCompletion, which is part of the DJIRemoteController class.
I tried to fill the DJIRCCustomButtonTags object to provide it as a parameter of the method, but I don't know which values are valid for c1buttontag and c2buttontag. Does anyone knows something about using the setCustomButtonTags method?
Valid values are in range [0, 255] (documentation).
You can set you own values, but it doesn't make the buttons do anything. Instead you could read the values after they are set by DJI's own application, add button listeners, and do some stuff when button state changes.
As far as I know, the values used by DJI's application are not documented anywhere. So you'd have to find out their meaning one by one. And then implement the functionality one by one...
Here is an example (for Android) for implementing button listeners: https://github.com/dji-sdk/Mobile-SDK-Android/issues/286
I have the problem below.
When I want to get the result with "querystring" from other cell,it just return the string type result.
When I get the "querystring" from B10,it just show the
=filter(B2:B5,B2:B5 = "John")
It's not incorrect,but I want the result "John".
How can I solve it to get the result directly or it need to put double quotation,single quotation at somewhere?
you need to add = in front of the formula
it kind of does not make sense what you ask, however, try to press:
which will trigger formula mode view to on/off
I want to replace some string in my url like this
request.RawUrl.ToString().Replace("sometext566666", "othertest")
but it s not working why is it so?
For example, the original url is like
/sometext4554544454.aspx
and I want it like this
/sometext.aspx
I'm guessing that this is .NET. If so, you should be aware the String.Replace() returns a new string containing the result of the replacement (as do all other methods that purport to modify a string).
So you need to assign the result to a variable or field to hold the result. In some circumstances, you might assign the result back to the same place you obtained the original string from. But you're not allowed to overwrite RawUrl (and, it would be potentially confusing for you to do so).
The statement you are using is working, but you are not assigning the result of the replace function, just executing it.
request.RawUrl.ToString().Replace("sometext566666", "othertest")
If you want to keep the result, you will need to assign it to a string.
e.g.
String result = request.RawUrl.ToString().Replace("sometext566666", "othertest");
Otherwise, you can assign it to the same RawURL but I think that is a URI so you'll need to use a new URI, something like:
request.RawUrl = new URI(request.RawUrl.ToString().Replace("sometext566666", "othertest"));
Nevertheless, I'm not sure if you can actually edit that property.