Example input
Prompt #1
Need help with formulas to upload data from a site element, through ImportXML in GoogleSheet document. Compose a formula for me to unload and structure the price of the item.
Example code from the site:
<span _ngcontent-serverapp-c133="" class="price">1.99</span>
I need to write a formula to take the URL of the page from cell A2 and use the formula to upload the price to cell B2
Replace in the formula as a comma separator with a semicolon
Prompt#2
You need to add sorting to this formula in order to write an integer number in the cell:
Example of what you get:
2.99
Example of what is needed:
$2.99
Replace in the formula as a comma separator with a semicolon
Example output
Prompt #1
To extract the price from the given code using ImportXML in Google Sheets, you can use the following formula. Replace the comma separator with a semicolon as requested:
=IMPORTXML(A2; "//span[@class='price']")
Place this formula in cell B2, and it will extract the price from the URL specified in cell A2.
Prompt#2
To add the dollar sign to the extracted price and replace the comma separator with a semicolon, use the following formula:
=CONCAT("$"; SUBSTITUTE(IMPORTXML(A2; "//span[@class='price']"); ","; "."))
Place this formula in cell B2, and it will extract the price from the URL specified in cell A2, add the dollar sign, and replace the comma separator with a period.