I am trying to split the below data into responses for each question.
{"question_2":{"1":"5","2":"0","3":"7","4":"8","5":"9","other_comment":""},"question_3":{"1":"0","2":"11","3":"0","4":"0","5":"0","other_comment":""},"question_4":{"sub_question":{"15":"2","16":"3","17":"2"}},"question_5":{"option":"3"},"question_6":{"option":"3"}}
The moment I use Data-->Split text to columns, Spreadsheet automatically splits the data using "comma" as the separator.
But I want to use a custom separator ,"q but I am unable to apply this custom separator after the data is already split.
When you select Data|Split text into columns you should see a drop-down saying Separator:Detect automatically. If you use the up/down arrows to change Detect Automatically to Custom, you can put in any character or combination of characters you choose.
You can also use SPLIT as mentioned by I'-'I but you have to remember to put the third parameter as FALSE to specify the whole string "q and not the individual characters " and q. Use "" to get a " within a string.
=split(A1,"""q",false)
Related
I'm extracting text from filename cells into separate metadata field cells. So far I have done this successfully using the REGEXTRACT formula, as seen below.
=REGEXEXTRACT(A1, "TILEABLE|ROOM|MAIN|FLOORSHOT|SWATCH|ANGLED")
However some metadata fields that include multiple words require that a space or other character be placed between words. I'm trying to figure out how to use SUBSTITUTE or REPLACE in conjunction with REGEXTRACT to find a phrase and replace it with a version with something different. Ex. Replace "TOPDOWN" with "Top Down" or replace "1TO1" with "1-to-1).
Depending on your purpose one formula might be better than other. If you want to list in a column the substituted values of this string you could chain the number of phrases you want using SUBSTITUTE and REGEXTRACT.
This will return all the phrases you are looking for and substitute them to then use the formula TRANSPOSE to take this range and display it in a columns (as it normally would be displayed in a row and only a single value). This is a simple example:
=TRANSPOSE({SUBSTITUTE(REGEXEXTRACT(A1,"TOPDOWN"),"TOPDOWN","Top Down"),SUBSTITUTE(REGEXEXTRACT(A1,"SHIRTS"),"SHIRTS","Shirts1")})
try:
=SUBSTITUTE(SUBSTITUTE(REGEXEXTRACT(A1,
"TOPDOWN|1TO1|TILEABLE|ROOM|MAIN|FLOORSHOT|SWATCH|ANGLED"),
"TOPDOWN", "Top Down"),
"1TO1", "1-to-1")
We have a BigQuery table whose data is coming from a Google Sheet. Occasionally, querying from that sheet breaks because there are cells that start with + character.
Example:
+search +terms
The query result responds with:
Which is not really a formula or something; I just want that text to appear in BigQuery as is.
Manually placing a prefix apostrophe ' on that cell (or the column where those cells belong) will work for that query instance. But because new data comes automatically at no set schedule, makes that procedure out of question.
Is there some option in BigQuery that we can set so it interpret such texts literally?
You might be aware of the fact that + and # are actually reserved characters in Google sheets, entering the desired function you want to use in the particular cell.
Mentioned above, If you don't want to supply a predefined formula function after typing one of these special signs, consider adjusting quotation marks (" ",' ') to detach the user data.
As long as Bigquery leverages Sheets data connector to deal with Google spreadsheets it is not equipped with any of instruments to intercept the broken cells #NAME?, thus the hand on intervention should be performed in the relevant sheet file in order to align the columns with an actual context.
As a quick solution looking for some concerns, you might be able to fetch the context from #NAME? cell adopting FORMULATEXT() function in neighboring rows as well:
FORMULATEXT(cell)
or replace some symbols:
SUBSTITUTE(FORMULATEXT(cell),"=","+")
I have a DSV file and each row corresponds to one instance/piece of text as normal. Specifically, I have my own delimiter ### instead of the default (i.e., comma ,). However, when I open the DSV by using Google Sheets, these tools always display the DSV file by splitting automatically by default delimiter. It causes a mess because some columns may contain several commas.
How can I disable the trigger that splits the text into columns automatically and only use my own delimiter?
My DSV is like below:
a###b###c###d,e,f,g###h,",",j
h###i,j,k###l###m###n,"[o,p]"
q,r###s###c,u###v,w###x,y,'z,'
As suggested, I have tried to copy the content directly to a newly created Google sheet, however, I got the error as below due to the size of the content.
There was a problem
Your input contains more than the maximum of 50000 characters in a single cell.
With File > Import > Upload > Drag one can choose one's delimiter (though not, as far as I am aware, as in Excel the option to "Treat consecutive delimiters as one"):
So, depending upon your specific file, you may find the result this way is what you want - provided you are prepared to delete a couple of blank columns for each set of ### (if not choosing a single character rather than ### in the first place).
if you import your CSV data into Google Sheets via copy-paste you can press this combo right after importing it:
LEFT ALT + D
E
ARROW UP
ARROW UP
ENTER
and type in your ###
I have a data set of contact details where the emails and their names are scattered in rows, I would like to list them in 2 nice columns. I've tried using "paste special" and use this code below, but none of them worked.
This is how it looks like:
I've tried this code, but it only applies to one row, whereas I want to apply it to all rows and columns.
=transpose(A2:R2)
and
=transpose (A2:R300)
Both don't work. I hope somebody can help me with this, I'd really appreciate it. Thanks in advance!
It looks that you are using the wrong terms so you are using the wrong functions.
Apparently you have a cell with data separated by spaces and break lines and you want to have each email and name on it's own cell, having emails on one column and names on the next column.
One way to achieve that, first replace the separating spaces by using a character like | and the break lines by another different character like $.
Note: Some people use Unicode characters that are very unlikely to appear like ♦, ❤.
To do the above for break lines you could use FIND and REPLACE (Ctrl + H) or function formulas like REGEXREPLACE, SUBSTITUTE, and maybe others. As there are spaces used both as word separators and values separators, FIND and REPLACE can't be used easily. For a single cell, maybe the easier way is to insert the name/email separator manually.
Then separate the cell data. To do this you could use a formula function like SPLIT or Data > Separate values into columns.
Another way is by using Google Apps Script and JavaScript string handling methods but basically the algorithm is the same.
Related
How to split this complex string into 3 columns and 50 rows using Google sheet script
Google Apps Script: Create new rows for cells that contain commas
Google Sheets: string to columns and rows
It's not the best system but I've been using ImportXML to pull in YouTube view counts for my videos so I can keep track. I knew at some point YouTube would make a front end change that would break this. So now recently instead of just the number inside of the DIV I am referencing they are always showing the word "views". So here's what I'm using now
=IMPORTXML("https://www.youtube.com/watch?v=qXnr03IIPTI","//div[#class='watch-view-count']")
This will output "300,000 views" (or whatever the current view count is)
Before they added the word "views" in this DIV I was able to add up this column. So I added another column to strip out the text.
(where G7 is the cell containing the above value)
=SUBSTITUTE(G7, "views", "")
I thought for sure I would then be able to run a SUM on this column but alas the SUM is 0. I believe this is something Excel would be able to deal with.
Any ideas here?
Bonus points if you watch the video :)
If the result is in G7, use formula:
=JOIN("",REGEXEXTRACT(G7,"([0-9]+),([0-9]+),?([0-9]+)?"))*1
it will convert string "300,000 views" into number. It'll handle bigger numbers, like: 1,368,142 views. This formula replaces commas because in some countries comma is used as sepatator integer and decimal part of number.
You can convert it to a value:
=VALUE(REGEXREPLACE(IMPORTXML("https://www.youtube.com/watch?v=qXnr03IIPTI","//div[#class='watch-view-count']")," views",""))
or
=VALUE(REGEXREPLACE(IMPORTXML("https://www.youtube.com/watch?v=qXnr03IIPTI","//div[#class='watch-view-count']"),"[, views]",""))
if you really want the commas etc, wrap the final amount back into a text at the very end if you want such as =TEXT("FINAL SUM","#,#")
Try this:
=REGEXEXTRACT(IMPORTXML("https://www.youtube.com/watch?v=qXnr03IIPTI","//div[#class='watch-view-count']"), "[0-9]*\,[0-9]+[0-9]+")