Pull different size of Products and availability from URL to Google sheet - google-sheets-formula

Hello Everyone I am trying to extract Different sizes available for all product from URL to googlesheet but it is Showing N/A everytime when I try to get it using IMPORTXML. I am copy xpath from rightclick and Paste it into formula still not able to extract information. URL is safguard.com where all the safety shoes can be ordered.
Please find below Link:https://www.safgard.com/mens-shoes?min_price=0&max_price=0&records_per_page=36&current_page=1&order_by_column=purchases_last_six_months&order_by_modifier=DESC&gender=M

try:
=INDEX(IFERROR(REGEXEXTRACT(QUERY(FLATTEN(IMPORTDATA(A1)),
"where Col1 starts with '$'", 0), "\$\d+.\d+")))

You can use https://simplescraper.io/ to scrap and send the data directly to Google Sheet.

Generate a separate product Link and then create xpath for class Labels which will pull all the sizes for all the products. Apart from that it will directly redirect to the page for convenience.

Related

Parsing Youtube - Xpath to retrieve a Youtube Channel's Profile Picture and Description

I would like to import the profile picture of a number of Youtube Channels into a Google Sheets spreadsheet.
This is the information that I have been able to retrieve so far:
To retrieve the profile picture, I have used the following code using Social Blade's website:
=IMPORTXML(D2,"//img[#id='YouTubeUserTopInfoAvatar']")
However while it doesn't result in an erorr it doesn't retrieve the image from the src. Any idea how to make it work?
In regard to the description, I would like to use a code that can be consistently used using either the channel's id or Youtube's username. Other solutions that I have tried have allowed me to get a truncated description, not the full one.
Maybe there is a more cost-effective way of doing this task, but without much Javascript experience this is the easiest way I have found to retrieve the information. Ideally, I would like to find a solution that calls on the Youtube API and bypasses the 50-call limit.
Here's a sample Google Sheets template to work on a solution.
OK. I've edited your Google Sheet. You forgot the #src attribute for the image.
=IMAGE(IMPORTXML(E2;"//img[#id='YouTubeUserTopInfoAvatar']/#src"))
And I've added the XPath for the Youtube channel description (add "/about" at the end of the youtube channel links).
=IMPORTXML(C2,"//div[#class='about-description branded-page-box-padding']")
Note : You have to fix your "ChannelID" formula to extract the ID.

Using Google Sheets for web scraping. Need the correct xpath for IMPORTXML function

There is a google sheet containing a list of MPN's (manufacturer part numbers). Trying to scrape a site called wikiarms for the UPC Codes when I have the MPN for an item.
I have the correct formula for doing this on another site.
=IMPORTXML("http://gun.deals/search/apachesolr_search/"&B1,"//dd/a[../../dt[contains(text(),'UPC')]]|//dd/span[../../dt[contains(text(),'UPC')]]")
Trying to figure out what the correct xpath to complete this formula. Some videos I have watch said to open the page in Chrome and use inspector to select and copy the xpath to complete the importxml function. I tried this with no luck.
Sample
Visit https://www.wikiarms.com/guns?q=20071
In the table there is a button "available in 6 stores" click that to reveal the list. The UPC should be listed after the MPN.
If I copy the xpath in Chrome this is the result
/html/body/div[1]/div/div/div[2]/div/div/div[2]/div[2]/table/tbody/tr[2]/td[5]
=IMPORTXML("https://www.wikiarms.com/guns?q="&B2,"xpath here")
What do I have to add at the end of this formula to pull in the UPC code? I will be using this formula to pull in UPC code for about 1000 items.
Thank you for your help.
Using your sample link, try
=IMPORTXML("https://www.wikiarms.com/guns?q=20071","//td[#class='upc']/a/#title")
and see if it works for you.

Difficulty finding out how dynamic ajax content is loaded

So I want to crawl information about the following 2 products:
1. http://www.dollargeneral.com/product/index.jsp?productId=86154836
2. http://www.dollargeneral.com/product/index.jsp?productId=58607576
Product No.2 offers "save 5% on all order with Auto delivery"
Product No.1 doesn't
When I crawl this page, the "div" about the offer part doesn't show up, so I think this information is loaded by ajax.
Now my questions is: after using chrome dev tool to check the "Network" using XHR filter, both URLs only send 1 request that contains seemingly useless information.
So where is the offer information coming from? Thank you!
These are two different products. One simply has the offer attached to it while the other does not. Some products include the offer and others don't.

Thumbnail different from actual image

Here is a scenerio, on my products page I want to add an image of the product dimensions but for this image I want to use thumbnail which is different from the actual image which will say Dimensions. This will be applied to all the products across the store. So there will be one thumnail image for all the products that will be associated with it’s dimensional image. I want to show it on the gallery page as last image.
Any help would be greatly appreciated.
Regards,
Avian
If I'm understanding you correctly, you just want every product to have a thumbnail that can be set to be one of several images.
You will need to create a custom attribute for your products, and then programmatically set your current inventory to your defaults. (Or manually change them) There is a knowledgebase article that will assist you with custom options (if applicable), or another article I found via Google to assist in custom attributes.
It's likely not the best way of doing it, but an example of the JavaScript method I was talking about is simply to add the following into a JS file on your server.
document.observe("dom:loaded", function() {
$$('.catalog-product-view .image-thumb:last img').each(function(item){item.src = 'http://domain.com/path/to/image.jpg'});
}

any tutorials/blogs regarding uploading more than one db images

I have exhausting goggle looking for a way to upload more than one db images.
I had a look at
http://www.mikesdotnetting.com/Article/125/ASP.NET-MVC-Uploading-and-Downloading-Files or http://mattias-jakobsson.net/post/2009/11/19/Handling-image-uploads-with-AspNet-Mvc.aspx or http://www.johnpscott.co.uk/devnotes/picpick/default.aspx or http://rusanu.com/2010/12/28/download-and-upload-images-from-sql-server-with-asp-net-mvc/ and so on. I no luck.
Does anyone has a tutorial or recommend a book that demostrate how to upload more than one db images. I am using vs 2010, asp.net mvc3 in C# with SQL Server 2008R2. All I am trying to do is to have couple db images for each product.
Thanks
The first link you provided is a good start for what you need.
Store all images for a product change....
It shows how to upload multiple files. From this you could modify the table where the images are inserted to add a key for the record relation back to your product.
Retrieve all images for a product change...
To pull them back from the database you would call the code in the same article (GetFile), modifying the select statement to include your product key INSTEAD of the ID of the individual image.
Display all images for a product change...
This is where it changes quite a bit. The author of the first article still returns one file as a FileContentResult. Obviously, this won't work for your situation.
Have a look at this article. It uses an XML file to load up multiple images BUT you would replace this code with the code in GetFiles to create the Image List. It shows how to create a controller, model and view for this. You could create a partial view to have the images on the same page as the product view.
This sample shows how to get an image list out of the DB into a view. (To help with modifying GetFiles to better work for this...)

Resources