Replace specific strings with specific images in Google Sheets - image

Essentially I am trying to build a google sheet that will convert specific strings into specific images for a Magic the Gathering google sheet.
For example, if I have the text {3}{G} I'd like to replace the {3} with and the {G} with .
I tried to use the substitute function, referencing cells where I had the images stored, but it didn't work. Any help anyone could provide would be much appreciated!

with some compromises, you can do:
=ARRAYFORMULA(IFERROR(VLOOKUP(""&REGEXEXTRACT(""&A2:A,
REPT("(.)", LEN(A2:A))), {F1:F&"", G1:G}, 2, 0)))

Related

AppSheet + Spreadsheet: AppSheet won't display formulaically generated image

I am stuck on this problem and request your guidance. Appreciate it in advance!
I am trying to display QR code images on the Appsheet. The images need to come from spreadsheet where they are stored in a column named QR code. The QR codes are unique for each row and are formulaically generated by an array formula in the first row of this column like this:
=ArrayFormula(if(isblank($A$2:$A), "", image("https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl="&$A$2:$A)))
In the appsheet I have tried making this column of type image, drawing, thumbnail etc. But none of it is working.
I read somewhere that such dynamically generated images don't work with appsheet. It would be really a bummer for me.
I also explored an option to add one more column in the spreadsheet where the image.png could be statically stored somehow. But I was not successful in that.
It would be really great if you could please help me solve this problem.
Thank you so much folks!
Just use the formula in your spreadsheet
=ArrayFormula(image("https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl="&$A$2:$A))
https://www.youtube.com/watch?v=hrfPldfrOcc

How to import list of zip codes per metro with ImportXML

I'm trying to import a list of zip codes by metro area from StatisticalAtlas.com (ex. https://statisticalatlas.com/metro-area/Michigan/Marquette/Overview) but am having trouble getting the =IMPORTXML feature to scrape any information.
It looks like the zip code section on the metro area pages from StatisticalAtlas isn't coded in JavaScript (I could be wrong).
Let me know if you have any suggestions that may work but this is the formula I am currently using in Sheets: =IMPORTXML H2, '//*[#id="top"]/div[2]/div/div[1]/div[6]/div[8]/div[2])'
Try this:
=IMPORTXML("https://statisticalatlas.com/metro-area/Michigan/Marquette/Overview","//*[#id='top']/div[2]/div/div[1]/div[6]/div[8]/div[2]/div")
To extract the zip codes and clean it all up, use:
=QUERY(ARRAYFORMULA(SUBSTITUTE(TRANSPOSE(IMPORTXML("https://statisticalatlas.com/metro-area/Michigan/Marquette/Overview","//*[#id='top']/div[2]/div/div[1]/div[6]/div[8]/div[2]/div")),", ","")),"Select * WHERE Col1 IS NOT NULL")
Starting at the basics IMPORTXML brings the zip codes over horizontally as formatted on the website.
We then TRANSPOSE the data to align vertically (remove if you want them horizontally).
Next we SUBSTITUTE out the comma delimiters with empty strings.
ARRAYFORMULA ensures we obtain the entire array of zip codes.
QUERY finally filters out NULL values (previously the comma's).

How do I insert images into a Google Sheet in Python using gspread (or any other package)?

I need a way to insert an image into a specific cell in a specific Google Sheet. If there is any python package and/or slice of code that can accomplish this, please let me know. As far as I am aware Gspread does not have anything helpful.
You can simply insert an image from an URL with a formula like this:
'=image("https://drive.google.com/uc?export=view&id={}")'.format(file_id)
When you insert/upload the data be sure to choose USER_ENTERED for value input option. https://developers.google.com/sheets/api/reference/rest/v4/ValueInputOption
With gspred:
sheet_instance.insert_rows(rows, value_input_option='USER_ENTERED')
Overall to add image into Google Sheets can be accomplished with Python by first inserting the image file in Google Drive using the Google Drive API:
Here is how to insert it to google drive. - https://developers.google.com/drive/v2/reference/files/insert#examples,
and secondly linking to the image in Google Sheets with the Google Sheets API, Here is Google sheets API - https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#CellData
Note: Look under CellData

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.

Google apps API, is it possible to search the text of a presentation?

I'd like to produce a list of all of the words that appear in a google docs presentation. I thought that the API would allow this, but it only seems that the spreadsheets API allows searching of the contents of the document?
This is correct, you can't get the content of the presentation with the Documents List API, but you can easily download an exported version of a presentation, for example:
GET https://docs.google.com/feeds/download/presentations/Export
?docID=0AsJD12345&exportFormat=txt
You can use plain text output and just split up the words.

Resources