Working with Google Sheets, scraping from an html table like this:
I want to get all the rows in JUST ONE CELL...
like this:
And I couldn't get the way to do it!
The expected result is to get all the table data in an unique cell...
replacing columns division, just by a blank space
and converting rows to simple text lines.
Any help, please? =(
NOTE: First values not always include de ":" character. Number of rows in table may vary.
Building from the previous answer you can try:
=QUERY(TRANSPOSE(ARRAYFORMULA(CONCAT(QUERY(TRANSPOSE(importxml_formula),,9^9),CHAR(10)))),,9^9)
Explaining the breakdown:
QUERY(TRANSPOSE(importxml_formula),,9^9)
This returns a table with one row with the number of columns as rows in the original table, with the result of each column is the data of each row in the table.
ARRAYFORMULA(CONCAT(QUERY(TRANSPOSE(importxml_formula),,9^9),CHAR(10))
Each column will be appended with CHAR(10), which corresponds to a line break.
TRANSPOSE(ARRAYFORMULA(CONCAT(QUERY(TRANSPOSE(importxml_formula),,9^9),CHAR(10))))
Transpose the table into 1 column, x number of rows, and finally the last QUERY merges the column into a single cell.
Sample Output:
Update:
Your IMPORTXML() already returned a single cell, and since they can be split by double space, you can use this formula instead:
=QUERY(ARRAYFORMULA(CONCAT(TRANSPOSE(SPLIT(IMPORTXML(A1,B1)," ",,FALSE)),CHAR(10))),,9^9)
try:
=INDEX(SUBSTITUTE(SUBSTITUTE(QUERY(SUBSTITUTE(FLATTEN(QUERY(TRANSPOSE(
your_formula_here
),,9^9)), " ", "×"),,9^9), " ", CHAR(10)&CHAR(10)), "×", " "))
Related
I am trying to extract from a data set like this one above the numbers from the row named waiting into a new column but if I try to do the result is correct in some rows but others are giving me the last numbers on other rows .
I would like to have the information from the specific row including decimals, into a new column but not to get the other numbers .
Please try this
library(stringr)
data <- c('t1 waiting 1234', 'waiting 1234.5')
data <- trimws(str_extract_all(data, '\\s\\d.*'))
data
I have a data frame that looks kind of like this...but much larger
I want to look at the record_id column and shift the right side columns down when the row says admin_time. Then make that previous row NA. Then when I write it to a csv, I'll just use the na = "" to make those cells blank
For example, in the first few rows, it would look like this...
No need to try to recreate the data frame. I was thinking maybe a for loop would work with an embedded if statement to review the patient_id, record_id, and pk_day. I was just looking for alternate suggestions or how to use a statement within the loop to pick out the admin line and do what I mentioned above
I try to select just one row in my data but the result come out in new data and I can't compute the mean of this, because the header is showing. But when I select the column, there is no problem and I can see the result as a value. You can see the result of the code in the photo that y is in data and X is in the value.
y=mydata[1,]
X=mydata[,4]
enter image description here
you should use rowMeans.
When you select a row you are selecting multiple variables and that results in giving you a dataframe.
I have an XL file with about 5500 lines. One column is all numbers with many repeats like zip codes. How can I count how many numbers are in that column but eliminate duplicates. For example, maybe there are only 250 zip codes in the column. How can I count that?
Select your column then go to Data -> Additional: then select 'copy result to another column', select result position and check 'Only UNIQUE records', it will copy unique records to selected colunm.
Now you can just select all this column and look how much records there are.
The best thing to do is do it in steps.
First grab that whole column of values. Dedupe it. Paste it into it's own column.
Then down the line, put in this formula:
=COUNTIF(F18:F27,G18)
where f18:f27 is the range to check, and g18 is the number to check for. Copy that formula all the way down the list of unique values.
I want to exclude entire rows that have blanks for a specific column....I dont want to show a row that has the first name column as a blank...I was thinking maybe a case statement would help with this
case when [First Name] = blank then exclude???
If this is SQL, in general you could do this:
SELECT *
FROM myTable
WHERE myCol IS NOT NULL
I had to add a calculated column that would be used as a flag, and then filter on the flag.
if(Len([First Name])>0,1,0)
Now I am able to filter on the calculated column to show only rows that have 1 in it (which will be the rows where First Name is not empty).
This doesn't delete the row from the dataset, but has the same effect in visualizations as if it had been.