Single Quote added automatically in front of numeric data when importing CSV file to Google spreadsheet - google-sheets

When I import a csv file to Google spreadsheet a single quote get added in front of all numeric data.
How can I remove that ?
I using import option from file menu

Try this:
right-click the column letter (on columns with numbers)
press Ctrl+F to invoke Google Sheets Search
to the right of the search box, click the ⋮ vertical 3 dots button
to invoke the Find and replace window
in the Find box, put the ' single quote (no space after)
leave the Replace box empty
click the Replace all button (on the bottom)
That should do the trick

put a column in notepad ++ enter image description here
make replace, and return column to GD

For me "Find and Replace" didn't work since those single quotes are not found by it.
I could only get rid of the single quotes by formatting affected cells/column as an integer numeric one.

Related

How to remove a piece of text from a cell?

I'm trying to remove a piece of text (Perfomance) from a column in Google Spreadsheet that contains (XX Performance) XX is a number like 89. I'm using:
=REGEXREPLACE(D:D, " Performance "," - ")
But no love...
enter image description here
Try this Example Sheet
=ArrayFormula(IF(D2:D="",, REGEXEXTRACT(D2:D, "[0-9]+")))
You can use the expression \D+:
\D matches any character that's not a digit (equivalent to [^0-9])
+ matches the previous token between one and unlimited times, as many times as possible, giving back as needed
The formula will be like:
=REGEXREPLACE(D:D, "\D+","")
UPDATE
I did put it in another column otherwise it creates a circular dependency. The data is imported via API from another app.
Then you will need to create another sheet or use a hidden column to put that information and then use the regex on the column you want the final result.

Google Sheets pretty formulas formatting

I'm finding these increasingly harder to manipulate.
is there another way that avoids using the formula bar?
Some text editor that provides indentation perhaps?
You can press:
Ctrl + Enter on Windows
⌘ + Enter on a Mac
inside the formula editor bar to add new lines to your formulas in order to make them more readable.
To comment inside formulas, you can use N().
For example:
=SUM(A1:A)+N("This is a comment.")
this will give exactly the same result as:
=SUM(A1:A)
Note that:
N("This is a comment")
returns 0.
If you want to avoid that, you can use T(N("comment")) which acts like a blank string.
Example:
Probably not the best answer, but as I had the same problem before, what I do is copy the formula to a text editor (or pastebin), ident the formula, select all and then repaste in the google sheets formula. If pasted it will have a line break, like this:
={
ARRAYFORMULA(somecomplicatedstuffhere) ,
ARRAYFORMULA(moreformulashere)
}
Also, if you are inside the cell, you can add a newline this way:
Windows: Ctrl + Enter
Mac/ Linux: ⌘ + Option + Enter

Google Sheets: How do I include a newline within a field in a local .tsv file I want to import

I know that in Google Sheets I can type Control-Return to create a sort of "phantom" return that starts a new line within a field. But what is the actual character that represents this? Obviously it's not ASCII code 13, as that is the record separator.
I would like to be able to include this mystery character in a local .tsv file which I import into Google sheets, so that these multi-line fields will display as such. Is this possible?
Thanks!
it's CHAR(34)
so something like the following in a cell would give two distinct lines of text...
="direct text input"&A3&" more text"&CHAR(34)&"Newline with new text"
Q: Google Sheets: How do I include a newline within a field in a local .tsv file I want to import
A: Surround that field with "
Update: Only when working with CSV. Google Sheets TSV doesn't seem to include the 'new lines'. More info on the link at the end.
In technical drawing class I learnt that if you don't know how to get A-->C, try to go C-->A and draw conclusions to help you achieve your goal.
If you have this CSV text file
The google sheet will look like this
Which I obtained going the other way around.
If surrounding the field with " is not possible, you may want to use this formula, which does the opposite (changes 'new line' for § ) [adapt to your needs].
# For a whole column, if there are 'new lines' in the cell,
# copy the cell changing them to '§' otherwise copy the cell 'as is'
={"description";ArrayFormula(IF( REGEXMATCH(G2:G; char(10)) ; REGEXREPLACE(G2:G;char(10);char(167));G2:G))}
More rambling here
Inspired by #MattKing's answer, an import of a *.tsv file containing this example content (note the double-quoting within the 2nd column value) ...
"example value with no line breaks" "=""line one""&CHAR(10)&""line two"""
... seems to have the desired outcome ...

How to trim starting spaces of entire column in LibreOffice or Google sheets?

I'm a bit of a newbie at this, so hope to get some help.
I have a large spreadsheet where columns C and D each have a blank space before the data in each column. Can some one please explain me how to trim an entire column to remove starting spaces in LibreOffice of Google Spreadsheets
In LibreOffice:
1. Select the cells you want to change
2. Edit -> Find & Replace
3. Find: ^\s+
4. Replace:
5. Other Options - Regular expressions: ON
6. Other Options - Current selection only: ON
7. Click Replace All
In Google Sheets, I would do the following.
First, enter the formula =arrayformula(trim(C:D)) in some cell of the first row, for example E1. It will fill two columns (E and F) with trimmed values (removing spaces at the beginning and end of each string).
Then copy the contents of columns E-F and paste values only in C-D; this is done with Ctrl-Shift-V, or by selecting "paste special -> values only" from the context manu.
In LibreOffice you can trim all spaces (beginning and end) via the "text to column" function:
Data -> "Text to Column"
Then assure the column is not being split (e.g. select tab als separator, if no tabs are present) and select "Trim spaces"
I'm sure the other answer works, but if you just need to do it once, I have an easy option. Download Sublime Text or some other text editor. Look for spaces at the beginning of a string (using ("^ ") without quotes should do it), and erase them.
Text editors are really helpful for normalizing data like this when you don't need updates in the future.

UltraEdit: How to search only in the first line

I have a DAT file with multiple lines and I want to search only on the first line.
For example, my DAT file contains this text:
Field1þField2þField3þField4þ
JohnþUKþStevenageþ9012þ
MerlitþUSAþBelAirþ56þ
I want to search how many fields I have (in this case, there are 4). If I search for þ, the search is executed across all rows and I get 12 for this example.
Select the first line in the file (SHIFT+END if your cursor is at start of file). You can then go to the Find dialog box and you should see an option to only search "Selected text".
Update: I'm using UltraEdit version 22.10.0.12

Resources