I am trying to create a column that imports the analyst price target from TipRanks website.
I uploaded two images:
Image 1: you can see the cell that I want to import.
Image 2: you can see my function that doesn't work.
What should I change in order to get this live info?
Thanks.
The site you are checking is actually "javascript" generated thus import functions won't properly work on them.
To check, just try to import the whole site data. If it returns a javascript function, then it is javascript generated.
Sample (tipranks.com)
What you can do is actually try to find other sites that provide the same data.
I did find one with the same data you are looking for, 50.38 for csiq. Link is "https://www.marketwatch.com/investing/stock/csiq/analystestimates". And since data is shown as table, it would be easier to import using importhtml.
Cell formula is:
=INDEX(IMPORTHTML("https://www.marketwatch.com/investing/stock/csiq/analystestimates", "table", 5), 2, 2)
Sample output:
The table is the fifth one in the DOM, and INDEX(table, 2, 2) means getting the 2nd row 2nd column of the table.
If the site is no good for you, you can try finding other sites that would suit your needs. And then use either importhtml or importxml depending on the site structure.
When you inspect the network when the website is loading you will see that the prices come when calling the forecast endpoint https://www.tipranks.com/stocks/tsla/forecast. This in turn returns an html response which is probably generated with Javascript on the client because they use React on the frontend, but you can still see the preview in the Network tab of the browser dev tools.
You can then copy the preview in VSCode and prettify it, to try and pin point the span holding the price. Of course it won't be exact science, because the html tags are generated with some media queries, but you will get close enough to some extent.
After you get the xml path but you get an empty error, you can delete some tags until you get some text. Use search in google sheets to search for highest price label, and than continue adding tags until you get the desired value.
Here is what I managed to get:
Lowest price target:
=importxml("https://www.tipranks.com/stocks/snow/forecast", "/html/body/div[1]/div[1]/div[4]/div[1]/div[2]/div[1]/div[4]/div[2]/div[2]/div[4]/div[1]/div[1]/div[5]/span[2]")
Average price target:
=importxml("https://www.tipranks.com/stocks/snow/forecast", "/html/body/div[1]/div[1]/div[4]/div[1]/div[2]/div[1]/div[4]/div[2]/div[2]/div[4]/div[1]/div[1]/div[3]/span[2]")
Highest price target:
=importxml("https://www.tipranks.com/stocks/snow/forecast", "/html/body/div[1]/div[1]/div[4]/div[1]/div[2]/div[1]/div[4]/div[2]/div[2]/div[4]/div[1]/div[1]/div[1]/span[2]")
In time these methods might change depending on their development process, but you could use the above steps to update the script.
P.S. I wasn't satisfied with the marketwatch analyst price targets. I think the wisdom of the crowd is better on tipranks.
Try this one. Works perfectly fine on my personal Stock Portfolio on Google Sheets:
Lowest Price Target:
=importxml(CONCATENATE("https://www.tipranks.com/stocks/", A1,"/forecast"), "//*[#class='colorpurple-dark ml3 mobile_fontSize7 laptop_ml0']")
Average Price Target:
=importxml(CONCATENATE("https://www.tipranks.com/stocks/", A4,"/forecast"), "//*[#class='colorgray-1 ml3 mobile_fontSize7 laptop_ml0']")
Highest Price Target:
=importxml(CONCATENATE("https://www.tipranks.com/stocks/", A4,"/forecast"), "//*[#class='colorpale ml3 mobile_fontSize7 laptop_ml0']")
I am trying to concatenate 2 outputs in calculated text field. But I would like to draw a line in between them or at least give them a heading, so that the users will be able to identify them easily. I could make different fields and have them calculated. But the requirement is to concatenate 15 fields into one field. So, I do not want to create 15 fields and write separate calcs. See below example
Example 1)
Hello, this is an example of what I am trying to explain with an example (o/p 1)
Hello, this is how I would like to present to the end users avoiding confusion (o/p 2)
As you see above, I was able to concatenate 2 o/p's, but I would like to draw a line. This one scenario that would work for me.
Example 2)enter image description here
Users Watch
Hello, this is an example of what I am trying to explain with an example (o/p 1)
Admin Watch
Hello, this is how I would like to present to the end users avoiding confusion (o/p 2)
As you see in 2nd example, I would like to put a heading for o/p 1 as "users watch" and "Admin Watch" for o/p 2, so that the users can differentiate it.
I have tried sub-string function for example 2, it looks 'OK' but it would be of more help if anyone has better solution.
The beauty of Archer is that you can use HTML in the calculation; providing that the calculated field is a text field and that its display is set as text area.
You can use the following calculation:
CONCATENATE("<H3>Header 1</H3>", [Field 1], "<H3>Header 2</H3>", [Field 2])
I'm working on a Backbone project coupled with a koa/node backend that reads on a psql database. I setted a get route that is supposed to point to PDF files, and I was expecting to obtain base64 encrypted strings for each of them. I got this object instead:
{"0":37,"1":80,"2":68,"3":70,"4":45,"5":49,"6":46,"7":51,"8":10,"9":37,"10":196,"11":229,"12":242,"13":229,"14":235,"15":167,"16":243,"17":160,"18":208,"19":196,"20":198,"21":10,"22":52,"23":32,"24":48,"25":32,"26":111,"27":98,"28":106,"29":10,"30":60,"31":60,"32":32,"33":47,"34":76,"35":101,"36":110,"37":103,"38":116,"39":104,"40":32,"41":53,"42":32,"43":48,"44":32,"45":82,"46":32,"47":47,"48":70,"49":105,"50":108,"51":116,"52":101,"53":114,"54":32,"55":47,"56":70,"57":108,"58":97,"59":116,"60":101,"61":68,"62":101,"63":99,"64":111,"65":100,"66":101,"67":32,"68":62,"69":62,"70":10,"71":115,"72":116,"73":114,"74":101,"75":97,"76":109,"77":10,"78":120,"79":1,"80":149,"81":86,"82":203,"83":114,"84":26,"85":89,"86":12,"87":221,"88":247,"89":87,"90":104,"91":118,"92":120,"93":145,"94":235... }
Has anyone ever seen this kind of representation for a PDF file? How can I get this data back as a regular PDF file?
Thanks for helping!
This looks like a pretty broken way to get things out of a database. Your object is a pair of {position: byte}, as Python hints the first items are part of a PDF header:
>>> [chr(i) for i in [37, 80, 68, 70, 45, 49, 46, 51]]
['%', 'P', 'D', 'F', '-', '1', '.', '3']
Since you did not specify any libraries/code, I can’t provide any direct advice, but you should check what your database really contains (this should be a BLOB of binary data, not base64 or crazy JSON) and how to get the raw binary data out of your database using the libraries of your choice.
I think there may be a bug with related products. I have added the following front-matter to my product.html page:
product:
related_products:
limit: 20
similar_by_views:
limit: 20
Regardless of the limit I set for related_products, I am never able to get more than 5 back from the server. If I set it to 1, 2, 3, 4, or 5, it works, but if I set it to anything larger than 5, I only get 5 products.
This is not true for similar_by_views. That settings works correctly. Is this a bug with related_products?
5 related products is the limit of the core app to be displayed. Stencil documentation is being revised to reflect this. It is intended behavior, not a bug.
I have a function that takes non specified number of PDFs (in a List) and turns them into 1 PDF using the PdfFileEditor.append function, like so.
pdfFileEditor.append(streams.get(x), streams.get(y), 1, 1500, outputStream);
The function that controls the merging is usually fine. Except there is 1 PDF in the application that seems to always eat anything that was appended before it.
For example, if we have 5 PDFs where number 3 is the bad one.
We can either use a forward loop (append 1 and 2, then 1&2 and 3, then 1&2&3 and 4, then 1&2&3&4 and 5) or a backwards loop (append 4 and 5, then 3 and 4&5, then 2 and 3&4&5, then 1 and 2&3&4&5) to combine the PDFs.
In a forward loop, we end up with only 3, 4, and 5 in the final PDF. In a backward loop, we end up with 1, 2, and 3 in the final PDF.
I am not sure what's wrong with PDF 3. It opens fine. But it does appear to be a dynamic PDF (has fields etc). I tried both forward and backwards loops because I thought maybe the PDF type was causing a reset to occur on the output stream somehow.
Has anyone seen the append method essentially just ignore a stream before?
Notes
I know this is a deprecated package from Aspose. But company standards means we cannot update to the new package.
Code is helpful - I can include the method, but it is long and the issue is clearly with the 1 PDF. Everything works in all cases except when a certain PDF is included in the list.
I am social media developer at Aspose. I would suggest you to download and try the latest version of Aspose.Pdf at your end to see if the problematic file works fine with the latest version. Also, it would be better if you save your complete code, version of library you are using and the problematic file with us.