I need some help regarding Google Sheets. I'm working on some game data and all the stats are in a JSON structure in a cell. I want to export it base on the variables I need to get.
Please see link here for sample input and output.
https://docs.google.com/spreadsheets/d/1XyCC_0h5JvVOHvtW5Xh5ng4ZSHgmCQJ1D2PAL2zkgIM/edit?usp=sharing
updated formula:
=index(let(
a,transpose(trim(split(A2,char(10)))),
b,query(a,"offset 1"),
textjoin(char(10),1,ifna(byrow(a,lambda(z,ifna(regexextract(z,"key.*""(.*)"""))))&": "&byrow(b,lambda(z,regexextract(z,"value.*""(.*)""")))))))
Related
I want to use IMPORTHTML() to import data from a table at http://www.cophieu68.vn/atbottom.php; but IMPORTHTML() fails to keep the original format of the data, causing misleading information.
Specifically, I enter =IMPORTHTML("http://www.cophieu68.vn/atbottom.php";"table"; 2) into A1 cell of Google sheets. Google sheets successfully imports Table 2, but wrongly adds symbol * into my data. Consequently, SVD becomes starSVDstar (Please note cell B2 on my screenshot below) or 9.3 become star9.3star (Please note cell C2).
Moreover; 401,300 becomes 401,3 (Please note cell H2 ).
Besides, 29.1 is understood as 29/01/2021 (Please note my mouse click at cell K2 on my screenshot below)
Here is the screenshot of the original table that i want to import:
https://drive.google.com/file/d/1wgJcO4O-ivpsXk0XetXzwdhSs4d_8Cjy/view?usp=sharing
and here is the screenshot of the table which is imported into my Google sheets
https://drive.google.com/file/d/1DLipA3o85MTGo2ktumTU_0A45vhuLSA6/view?usp=sharing
Could anyone tell me what is wrong with my formula and how can I fix this error?
Thank you very much for your help.
Cao
Explanation:
The source page HTML is controlled by JavaScript, so the raw output of =IMPORTHTML cannot be changed whatsoever. However, you can use this formula on a new sheet to remove the asterisks from the original table.
If your IMPORTHTML is in Sheet1 you can use this:
=ARRAYFORMULA(SUBSTITUTE(Sheet1!A2:M,"*",""))
I suggest using regular expressions to solve the table import with a single formula:
=arrayformula(regexreplace(to_text(IMPORTHTML ("http://www.cophieu68.vn/atbottom.php ", "table", 2)),"\*(.*\/?)\*","$1"))
(I have added the function to_text to avoid losing the two zeros at the end of figures that are in units of thousands)
I'll start by saying that my knowledge on using APIs is extremely limited. I'm impressed I've gotten as far as I have on this.
I've created a workbook in Google Sheets with imported data from the iexcloud API, which I'm using for data on stocks.
The requests have a cell reference in them so they update whenever a different symbol is selected.
So far, everything I've needed to request from it has the option to format as csv, so I can get cells with just the values.
However, this last thing I want doesn't have that option, so the whole response is wrapped in ["" ].
That really messes up what I need it for.
Here's an example
["PSA" CCI SHO ACC]
with each symbol being in its own cell.
I'm using the Peer Groups request.
A sample request:
> https://sandbox.iexapis.com/stable/stock/aapl/peers?token=Tsk_2b4c7c6fd98542f6a99f904cb7a3e721
Using Find and Replace doesn't work. I'm assuming because it's imported.
I need to use the cells with those symbols: PSA, CCI, SHO, ACC to reference in another request.
I recreated this in another Google Sheet that you can edit. The section in question in highlighted in blue
https://docs.google.com/spreadsheets/d/1BQ6FBD0S2YkDtDGZGIkDmQoKrQT4VmVDjuNsgV4mrXM/edit?usp=sharing
So I'm wondering if there's a way to have [ " ] automatically removed from any cells in that row, or if I copy and paste the values only, to have the values updated when the original cells are updated with new symbols (since I can have those characters removed in that row)
Or if there's a way I can format the response in sheets.
Any ideas?
I believe your goal as follows.
You want to achieve from ["CCI" SBAC CTL TDS RCI RCI-A-CT DTEGY] to CCI SBAC CTL TDS RCI RCI-A-CT DTEGY using the built-in functions of Google Spreadsheet.
Modified formula:
=ARRAYFORMULA(REGEXREPLACE(IMPORTDATA("https://cloud.iexapis.com/stable/stock/"&B3&"/peers?format=psv&token=###"),"[\[\]""]",""))
In this modified formula, [, ] and " are removed using REGEXREPLACE.
Please replace ### with your token at the above formula.
Result:
In this result, the values retrieved with =IMPORTDATA("https://cloud.iexapis.com/stable/stock/"&B3&"/peers?format=psv&token=###") are used. So the formula of cell "C9" is =ARRAYFORMULA(REGEXREPLACE(C6:I6,"[\[\]""]","")). But in this case, above modified formula can be used.
Note:
In this answer, I removed your token because I thought that it is your personal information.
Reference:
REGEXREPLACE
I have a cell value that contains an address. I'd like to cut a portion of that data then edit and paste the results into a separate cell. I don't know the specific language to clearly outline my question so any help would be appreciated. I created annotated images to help.
Original .CSV data I imported into Google Sheets
The data from that import that I would like to extract within the cell.
Data output once I run the Macros script. Original cell data is copy, edited, and pasted into next column.
I have thousands of data entries like this so ideally this script would:
Cut all data starting at 'County:' from Premise Address column.
Paste that data into the County column while removing 'County:'
I ended up using the Split Text to Column function in sheets. Then Find and Replacing the remaining unnecessary text. It's not pretty but it worked.
Gonna dig into REGEXEXTRACT formulae tonight for some fun reading. Thanks!
There are multiple different ways to do this but the simplest would be to use the REGEXEXTRACT formulae; if the data structure is exactly the same across all samples, you could use the following one in the County column -
=IFERROR(REGEXEXTRACT(A2,"County: (.*)"))
Assuming that the first Premise Address is in A2 cell.
I have a google form response sheet and I have created a separate tab for doing analysis on an individual response. Basically filling out a table which is then used to generate graphs and charts. Each time I need to do analysis on a single response, I have to change the formula to look at the specific response and then drag the formula down to update the whole table and which then creates a column chart in a separate sheet.
My question is- Is there any way I can simply select the response (like a button in the google chart dashboard sheet) which then looks at the response in the response sheet and updates the table in the separate sheet to give the graph accordingly?
I have not used any app script so far in my sheet for the dashboard? It is just a simple data validation method looking at the values from other sheet and gives the graph. Not sure if app script is the solution or any other solutions to work around this.
Help!!
Table to fill from google form:
Google Chart Dashboard:
You could use a query or "if" formulas to do what you are describing. Your query or if statement should point to a cell(s) which is have drop-down data validation lists, which when changed then alter your table, which in turn changes the graphs.
Example 1:
=query(Sheet!A:C,"SELECT A WHERE B ='"&D1&"'",0)
This query looks at the cell D1 and altered depending on its contents.
Example 2:
=if(D1="SOMETHING","DOSOMETHING","ORDOSOMETHINGELSE)
In this statement again D1 could be a cell that contains a drop-down list of variable data validation items.
Hope this helps
How to reference the same (row,column) on the different tab in the same google spreadsheet document?
So, I want to do something like this:
=SOME_FORMULA('First tab'!(ADDRESS(ROW(),COLUMN()))). This doesn't work.
If the formula isn't apsolutly referenced, entries of Google Forms questionnaire change the reference and mess up the formula. (the formula that looked at row number 5 after insert looks at row number 6) I can't use apsolute referencing ($A$1) because I have to enter it manually.
Can I change the reference on multiple cells? (for one I can use cmd + f4)
I had that annoying reference problem too. If I understand correctly you are trying to get the information on some cells, but every time someone sends information to the spreadsheet by filling up a Form, that reference moves down a row.
The best solution I came up with was to create a new SpreadSheet and import all the information with this:
=importrange("spreadsheet-key","Form Responses!A1:B2107")
That function updates the info in realtime, so you can do all the processing on the new spreadsheet.
Hope this helps.
Do not quite understand what you need. Need to reference a cell in another sheet given coordinates on the current cell where it is located?
If so, the following formula can be useful:
=INDIRECT("First tab!"&ADDRESS(ROW(), COLUMN()))