Getting inconsistent tab delimiter width when pasting from Google docs spreadsheet - parsing

I am trying to create a gadget for some people, where all they need to do is really copy the contents of a spreadsheet, then paste it in a textbox, which will in turn create a nice table for them to embed in their articles.
I managed to do everything, however Google docs, when copying and pasting data in a text editor, seems to get the size (width) of the tab delimiter wrong between values. So, instead of getting 4 spaces that is the default, i am getting 2 in some cases and so far i managed to find out that the reason is that some of the cells contain strings with spaces. For some reason, this seems to confuse Google docs, thus supplying wrong spacings, which in turn, ruin my script.
I know i can use comma separated values here, but the issue is we are trying to give people the ability to simply copy and paste. Look at the example output below:
School Name Location Type No. eligible pupils
In this example, School Name is one cell, Location is another, Type is another and No. eligible pupils is the last one. It is clear that the first cell does not have the necessary space on the right.
Any ideas? I thought about converting all blank spaces that take more than 1 space to commas, but this might lead to a situation users might actually use 2... which would not work again.

For some reason, it was the code editor that was actually not showing the tabs right. Using a regexp and another code editor (vim) showed that all of them were actual tabs. :)

Related

Remove text between square bracket in complicated array formula

I have a complicated formula that copies data from other cells on a different tab and I want to add the removal of brackets and text between them. This information is private so I don't want it displayed on the new tab. I am working in Google Sheets.
The formula below results in copying first name, last name, and a course that meets specific criteria on another tab. The problem is that we are indicating Legal Names with brackets on the primary tab, but those legal names should NOT be displayed on the new tab. I'm sure there is a better way to write this, but it works extremely well. I just need to add the removal of the brackets and texts between them. I know there is a way, but I can't seem to make it work with the current formula. HELP!
=IFERROR(INDEX('7th Class List'!$C$3:$E$66,SMALL(IF('7th Class List'!$A$3:$A$66="A",ROW('7th Class List'!$A$3:$A$66)-ROW('7th Class List'!$C$3)+1),ROW(1:1))),"")
its done like this:
=REGEXREPLACE(A1, "\[.*\]", )

How can I mark something as ‘yes’ or ‘no’ based on when two cells match as well as whether another cell is blank — in Numbers

I’m using Numbers on an iPad (I don’t have a Mac).
I have a list of physical tools on one tab. On another tab I have a table of dates and times when the tools were checked out and checked in.
On the first tab (where the tools are listed), I’d like to have a column that says whether or not the tool is available based on whether or not it’s been checked out but not checked back in.
So I want to write a formula that looks for the name of the tool on the second tab, and when it finds it, checks to see whether any of the checkin cells are blank. If there’s a blank one, the formula should print ‘no’. If there aren’t any blank cells, the formula should print ‘yes’.
Is this possible? If so, can anyone suggest a formula please? It’s a bit too complex for me… (I have rudimentary coding skills.)
Xlookup may help.
With XLOOKUP, you can find values in columns and rows, or look for exact, approximate or partial matches.https://www.apple.com/au/numbers/features/
XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
For example:
XLOOKUP(<cell>,Tool checkin::A,Checkin,"no",0,-1)
Then an if statement can turn it into a yes/no value:
IF(<cell>=0,"no","yes")

Transform comma separated google form answers to multiple lines in spreadsheet

I have made a google form to which some answers are formatted as comma separated strings inside the automatically populated google spreadsheet. I would like to read from this sheet to another sheet and reformat the answers so that each comma separated answer is shown on a new row. I have tried to apply an ARRAYFORMULA that reads from the original sheet and then use a solution that uses SPLIT and TRANSPOSE the cell content, however combined with the ARRAYFORMULA this fails since it would overwrite contents in other cells.
Here is an example spreadsheet with the responses, a solution sheet, and a desired results sheet. https://docs.google.com/spreadsheets/d/1r_l5fVJ9lGfpubO2o3pXicV7JlZWmANjwSgNi7_DL0A
Any suggestions for how I can achieve the end result?
Okay, I assume this isn't really what you want, but visually it looks okay...
Try this formula:
={{'Form responses'!A2:A3},ArrayFormula(regexreplace('Form responses'!B2:E3,", ",CHAR(10)))}
Then format the cells so that the cell contents are TOP-aligned, instead of the default BOTTOM-aligned.
Realistically, I imagine that you want each question answer split into multiple cells. But if your data responses really contain letter values separated by commas, as you've indicated, you can still search through those cells to find whether an answer contains a certain value. It all depends on why you want the results structured the way you do.
If you can clarify what you want to do with the form results, instead of just appearing vertically for each question, perhaps we can provide a full solution for that requirement?
UPDATE1:
Okay, I may be getting close. I can get your data transformed to look like the following:
This would let you do the analysis that you want, by searching for Q.1 (question 1 responses) in the first column, and then all the answers in the third column, along with the owner in column 2. And from this, it will also definitely be possible to put the results in the exact form you want. It just may take an intermediate step.
UPDATE2:
Okay, I think I have something you can use. I can convert your data to either of the following two layouts.
The one on the right is closest to what you asked for, with the exception that the answers on the right are bottom aligned, with blanks above. But you can still process them for analysis, with queries. I honestly think having the user identifier (email address) on each row would make things simpler, but I can provide it either way.
The layout on the left is more of a traditional database layout, and would make analysis very simple. Each row has the date and email identifiers, the question number, and the answer (or one of the answers) to that question, from that user.
If this is helpful, it might be best if you enabled your sample sheet to allow us to edit it, to enable me to implement it in your sheet. But here is my sample sheet, in case anyone wants to look through it. Note that the main formula to reformat the data, in Solution!B3, could benefit from a lot of cleanup, and is probably nowhere near the best way to achieve this. Just throwing up one possible solution...
I'll try to add some explantion for the formula at some point, but ask if you have any questions.

want to name the formula in drop down list

in my original workbook i want to display some values from another sheet for multiple actions.. so i put drop down list for each actions. but when the actions increased i couldn't recognize each formulas. (all of them are import range) so that if i can name each formulas in the drop down then i can recognize fast which action to be performed. here a sample sheet is attached for a solution.. pls take a look. in the dropdown list i included (=a2+b2) instead of that if it displayed as addition in drop down list would be help ful. please take a look.
sorry for my english
Any type of help would be appreciated.
https://docs.google.com/spreadsheets/d/1mpIWyQASMlxRVdlTkv9K1e4oihsrckjT6sD1mLDxvEc/edit#gid=0
If I understand correctly, you want to have a dropdown list menu (from Data Validation) that displays the operation name, but when you click it, it displays just the result.
This is very hacky, but here's a way to create some "labels" in your criteria box:
=IF(;"ADDITION";A2+B2),
=IF(;"SUBTRACTION";A2-B2),
=IF(;"DIVISION";A2/B2),
=IF(;"MULTIPLICATION";A2*B2),
How?(!)
After kicking around some no-op ideas, I finally settled on this as the cleanest and most flexible approach. (By some freak coincidence, it also makes some semantic sense too.) It works because when the first argument to IF is omitted, it defaults to 0 -> FALSE. This effectively makes the second argument to IF a comment/no-op, and always just selects the formula.
Yes, the semicolons are intentional or the parser will think of the args as list items.
Productivity Tip/Footnotes
Sheets will remove any line breaks in your validation criteria, so the formula will be hard to read when you have to edit it. If you anticipate that you'll be adding a bunch of functions later, save the above block in a text file and edit that. Then you can copy+paste it into the validation field.
It will also always show up as "INVALID" because the value will of course never match the formula text.

Google Sheets import multiple HTML table images

Summary
I'm looking to import a data table from a website that does not appear to have an API. The table is broken down to various images and text. The goal is to have all of the content available in a table to then reference for other sheets.
Issue
When I pull in the data, I get some of the text, none of the other images, and a reference to another table. I looked up some options, but none of them yielded anything but blank cells.
I also tried to use the =IMAGE() formula with a direct link to the images URLs, but there is a portion of the URL that is specific to the unit's release date, and as such, too dynamic to account for.
Excel Formula
=IMPORTHTML("https://gamepress.gg/pokemonmasters/database/sync-pair-list","table",3)
Unfortunately without an API it is going to be difficult to achieve what you aim here. These are the main reasons why:
PROBLEMS AND WORKAROUNDS
This table has nested tables that therefore need to be accessed separately. If you take a look at: =IMPORTHTML("https://gamepress.gg/pokemonmasters/database/sync-pair-list","table",4)
you will see how the table 4 of this HTML page is the stats of a random character of the main table. If you go for 5 or 6 you will realise that the nested tables are not even numerically ordered and that you cannot access them by accessing to the main table (i.e mainTable[0].nestedTable). A hard working approach to do this is to go one by one finding their corresponding stat table and placing next to it. For this I recommend extracting only the name field of the main table to be able to align each stat to their character. You can simply do this using:=INDEX(IMPORTHTML("https://gamepress.gg/pokemonmasters/database/sync-pair-list","table",3),0,1). You can find out more about INDEX here
IMPORTHTML cannot access images nor links so it will be very difficult to get the images in the last columns. A way to solve this is by using as you mentioned the image with its url like this: =IMAGE("https://gamepress.gg/pokemonmasters/sites/pokemonmasters/files/styles/30x30/public/2019-07/Electric.png?itok=fkRfkrFX"). You can find more info about inserting images here
CONCLUSION
To sum up, there is no easy way to solve this problem. The closest you can get is by:
Importing the name column.
Figuring out which tables belong to which character and placing them with next to their name.
Getting the image url of each weakness and type and add it to each character.
I am sorry this site does not have an API to make things smooth, good luck with your project and let me know if you need anything else or if you did not understand anything.
Here you can find more information about IMPORTHTML

Resources