I've a large TSV file that I'm viewing through MS Excel. I have a column showing arrays of coordinates. Unfortunately, the database from which the coords were taken did not include a comma separator between lat and long. The coords are formatted thus:
[[4.47917 51.9225],[-3.179559057 55.951719876],[-3.17055 55.9721],[-3.297777777 55.625],[-3.355388888 55.752611111]]
Whereas I need them formatted like:
[[4.47917, 51.9225],[-3.179559057, 55.951719876],[-3.17055, 55.9721],[-3.297777777, 55.625],[-3.355388888, 55.752611111]]
Is there a quick way that I can add these commas (the TSV has too many values for me to manually correct them).
I'm v much finding my way with this stuff so any help would be much appreciated.
Cheers
Yes, lucky you 😊 Ctrl+H to replace and replace with , . Replace space with coma followed by space.
Related
What i found:
https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/convert-csv
The Problem in the example the character to seperate is "," -makes sense its called comma seperated..- however since I have to use German formatted csv i have to get along using ";" instead, heres an example:
Datum;Nummer;Zahl;KFZ;AB1;AB2;AB3;Name;Ort-1;Ortsteil;Straße + Hausnummer;Objekt;Ziel;Z-Ortsteil;Z-Straße + Hnr;Ziel Objekt;Ini;A 1;B 2;C 3;D 4;E 5;F 6;G 7 / H 8;SR A1;SR B2
08.07.2021;123456789;5;AB 12/34-56;123;123;;Mustermann, Muster;Musterstadt;Musterort;Musterstraße 2; ;Musterstadt;Musterstraße 1; Musterhaus Musterblick;01:02:03;02:03:04;03:04:05;04:05:06;05:06:07;07:08:09;;09:10:11;0;0;
It should look like this:
https://snipboard.io/FB8HXW.jpg
By now i tryed to edit the Code and i was thinking about replacing ";" with "","" but i didnt found a way to insert an " at the beginning of each line in Power-Automate.
Sadly i wasnt able to get it work by now, maybe someone here can help me out.
As an alternative, you might want to use the -delimiter feature in Import-csv.
See online help
Example 2 shows creating a csv file using semicolon as the separator, and then importing it.
Sadly, the same feature won't convert numbers from German format to English format. This has to do with whether decimal fractions are introduced by a comma or a period.
I am loading a CSV into Apache Beam, but the CSV I am loading has commas in the fields. It looks like this:
ID, Name
1, Barack Obama
2, Barry, Bonds
How can I go about fixing this issue?
This is not specific to Beam, but a general problem with CSV. It's unclear if the second line should have ID="2, Barry" Name="Bonds" or the other way around.
If you can use some context (e.g. ID is always an integer, only one field could possibly contain commas) you could solve this by reading it as a text file line by line and parsing it into separate fields with a custom DoFn (assuming rows also contain newlines).
Generally, non-separating commas should be inside quotes in well-formed CSV, which makes this much more tractable (e.g. it would just work with the Beam Dataframes read_csv.)
I have a 3 column csv file. The 2nd column contains numbers with a leading zero. For example:
044934343
I need to convert a .csv file into a .xls and to do that I'm using the command line tool called 'unoconv'.
It's converting as expected, however when I load up the .xls in Excel instead of showing '04493434', the cell shows '4493434' (the leading 0 has been removed).
I have tried surrounding the number in the .csv file with a single quote and a double quote however the leading 0 is still removed after conversion.
Is there a way to tell unoconv that a particular column should be of a TEXT type? I've tried to read the man page of unocov however the options are little confusing.
Any help would be greatly appreciated.
Perhaps I came too late at the scene, but just in case someone is looking for an answer for a similar question this is how to do:
unoconv -i FilterOptions=44,34,76,1,1/1/2/2/3/1 --format xls <csvFileName>
The key here is "1/1/2/2/3/1" part, which tells unoconv that the second column's type should be "TEXT", leaving the first and third as "Standard".
You can find more info here: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options#Token_7.2C_csv_import
BTW this is my first post here...
I am trying to import reports in csv format to MySQL for further analysis process. But, I have find several negative numbers enclosed by bracket e.g ($184,919.02),
($182,246.50). If I use double format, it will become 0, but using varchar or text it appears.
I need it to be recorded in double format to automate some calculations in further analysis process. Is there any way to solve this problem? And also how to remove the $ (dollar) sign as well?
Thanks in advance.
Load into a VARCHAR column. Then update the column with REPLACE(col, '$', '') to get rid of the $.
Repeat to get rid of ,, -, (, ')` and any other garbage that is in the way.
Better yet, us a real programming language (not SQL) to cleanse the data. Many languages let you remove -$,() in a single pass.
I wonder if there is any way to generate culture neutral CSV file or at least specify data format of certian columns present in file.
For example I generated CSV file that contains numbers with decimal separator (.), and after
pass it to the client which is in the country where decimal separator is (,), client opens it with Excel and sees all values changed.
Is there any way to resolve this isure, or just in this case do not use CSV file ?
Thank you in advance.
What you want is a "quoted CSV file".
That is as well as separating your values with commas you also enclose them in (usually) double quotes.
Like so:-
"first","second","3,00","Some other text, etc."
This format is quite common and supported by EXCEL.
Two ways I came up with to avoid the decimal separator altogether:
1) Use scientific notation, so 1.25 would be: 123E-2
2) Make it a formula, so 1.25 would be: =125/100
Both pretty crappy, depending on your target audience, but at least Excel sees them as numbers and can calculate with them.
A CSV file will be separated by commas (the 'C' in CSV) but you can output a text with any delimiter and qualifier and you'll be able to open it in Excel - you specify them in the step 2 of the import text wizard.
A common choice for situations like this is to use tabs (TSV).
You can use Tab Separated Values, which does not vary between cultures and are supported by Microsoft Excel. Common file extensions are .tsv and .tab.
http://en.wikipedia.org/wiki/Tab-separated_values