Google spreadsheet formula for url with a variable - xpath

What's the formula to display an url in google sheet when part of said url is a variable from another cell?
I'll explain: in one cell I have this formula (used to scrape text with class 'description' in an html webpage, doesn't matter for the purpose of the question though)
=importXML("http://www.xxx.it/code/9788823506183/doc/book.html","//span[#class='description']")
The numerical part changes everytime based on the value in another cell, say B3.
Tried =importXML("http://www.xxx.it/code/(B3)/doc/book.html","//span[#class='description']") but of course it won't work.
Then I thought I could dinamically create the url in B2 and do like this:
=importXML("B2","//span[#class='description']")
One step closer but I'm stuck anyway, how can I generate such url in B2? I can't find a suitable function in the docs. I could only come up with:
in A1 = 9788823506183
in B2 = http://www.xxx.it/code/("A1")/doc/book.html but it's not the correct syntax. :(

In Excel, you'd do something like the following. Give it a try in a google spreadsheet.
=importXML("http://www.xxx.it/code/" & B3 & "/doc/book.html","//span[#class='description']")

Use CONCAT in Google Sheets.
=CONCAT("http://www.xxx.it/code/(", $B2,")/doc/book.html")
You may need a formula to get the exact spot in the string.

The following example starts a timer based on a cell value but could be adapted to build a URL out of any cell values. Assume that there is a number of minutes that you want to make a timer for is in $C20
1) Make a cell that builds the first part of the URL, in my case $E27:
=CONCAT("https://www.google.com/search?q=set+timer+for+", $C20)
2) Make a second cell that completes the URL, in my case $E28:
=CONCAT($E27,"+minutes")
3) Make a cell that contains a hyperlink that will call up the timer:
=HYPERLINK($E28, "Start a timer for cell value C20")
Then when you click on the cell you made in #3 a hyperlink will hover over and you can click on it.

Related

How do I address the current cell in a formula vs typing in the cell name (Ex: A2)?

I'm using the =IMPORTRANGE formuala to pull values from another spreadsheet and represent them in a comparison chart on another sheet. Here is the formula below.
=IMPORTRANGE("the link to my doc is here", "Wed. HEADCOUNT!C2")
^^^ this formula currently works. What I'd like to do is replace C2 with "currentcell" but this breaks the formula. I need to do this to repaste the formula hundreds of times without having to individually change each one.
Any thoughts?
I've tried putting in "currentcell", but this led to #REF error.
You can create a "virtual" reference to your current cell by using CELL("address",C2), which returns the address "C2", and then C2 will move when you copy the cell to another location.
So your formula will be this:
=IMPORTRANGE("the link to my doc is here", "Wed. HEADCOUNT!" & CELL("address",C2))

Is it possible to change a section of URL text when using IMPORTXML to a reference cell

So I am trying to use IMPORTXML to pull data for stocks, but I want to simplify it with referencing a cell to change the stock name in the URL.
=IMPORTXML("https://www.marketwatch.com/investing/stock/aapl/financials/balance-sheet","/html/body/div[3]/div[6]/div/div[2]/div/div/table/tbody/tr[3]/td[2]/div/span")
So is there a way to make the "aapl" part of the URL reference to a cell that has a new stocks ticker to change the URL to a that new stocks balance sheet?
I am very new to this, sorry if my question doesn't make sense or is dumb. Thanks for any help provided.
Try this:
=IMPORTXML("https://www.marketwatch.com/investing/stock/"&A1&"/financials/balance-sheet","/html/body/div[3]/div[6]/div/div[2]/div/div/table/tbody/tr[3]/td[2]/div/span")
Change A1 with the cell you want

BIRT - expression builder: HTML Table + Dataset field does not evaluate

I am new to BIRT and its awesome but I am unable to make a bullet point list where each bullet point is a field from my dataset. Without using any html the datasetfield evaluates but as soon as I add an html tag it will simply show the name of the field.
This
<ul>
<li><value-of> row["SRRI"] </value-of></li>
</ul>
Shows:
row["SRRI"]
But I want it to show the value of row["SRRI"] instead. (Omitting "" does not change the output for me)
I was searching for a solution for a few hours now and I guess its fairly simple but I cannot find a solution on how to tell BIRT that this is not a string.
It sounds like you have a list, and you want to lead each entry with a bullet point. In your report design, you can put a cell in front of your row["SRRI"] value and put what ever bullet image you want there.

XPath function to combine text nodes and retrieve it to one Google Spreadsheet cell

I'm completely rookie in XPath (I don't even know how to paste proper html into this post ;-p) subject and I need some help. I would like to retrieve text which is in quotation marks and put it into a one cell in Google Spreadsheet. Right now I can only retrieve this text into separate cells.
http://imm.io/oLYI
Does string(//tr[class='darkGreen']/td[2]) result in what you want? Your XML fragment looks incomplete and I'm not sure if you only want the contents of the second cell so it's a wild guess if this fits your need.

Facebook Game Function, Optimizin a Call, and Loading Bar

I am attempting to make a Facebook game and trying to replicate a common function that I usually find in many other Facebook game (a call to my website and illusionary image that is a loading bar).
The function should do the following:
User clicks on Button
Animated Gif Appears (Loading Bar)
Button Update User's Status
Animated Gif Disappears
Facebook Canvas page is updated
The code I currently have can be found at <dead link>
I am having trouble thinking of Step 2 and 4.
I need to optimize Step 5.
To clarify what happens on Step 5. I have Box 1 which has my stats. And Box 2 which has my points. I click on Box 1. This should update Box 1 with 1 points, and update Box 2; minus a point. (Clicking on Box 1, concurrently update both boxes)
I have successfully done this, but it is quite slow. I was wondering if there are alternative way that may be faster than what I am currently doing.
Script Updated with Mark-up. <dead link>
I've found a quick way to optimize the call. Rather than querying for data that I already have query, I will be using the first query to grab most of my data rather than querying it when I update.
It would help greatly to see the document markup (XHTML) where you have your elements and the calls to your javascript functions.
For steps 2 and 4 I recommend using the visibility attribute rather than display, or having the loading bar in an fb:js-string and using elem.setInnerFbml when you begin loading and once you have your response data, simply update it to the new content (you don't need an explicit loading_finish function in this case).
In your get_skillpoint function, you set parameters in an object and then you specify the action parameter again in the URL you are posting to as a URL query param - you may end up with one value overwriting the other, depending on how you access these values on the server side. I would recommend using different names for these two parameters if they are not the same. Also, why are you trying to send separate GET and POST variable sets? You should put everything in the POST and simply leave out the URL query string. I vaguely remember losing data that way in the past (vaguely, mind you).
If you can post your markup I'll update my answer with any light it sheds on the problem. It might be slow simply because Facebook isn't blinding fast when it comes to FBJS and AJAX. Also, FBML being returned must be preprocessed in the FB proxy before your app gets it, which adds a bit of lag; it's a bit faster to return JSON and just pull the data needed out of it, then place the appropriate pieces into an existing element or make use of fb:js-string.

Resources