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.
Related
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'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.
If i have a row like this.
536381,82567,"AIRLINE LOUNGE,METAL SIGN",2,12/1/2010 9:41,2.1,15311,United Kingdom
How do i get the output like this:
536381,82567,"AIRLINE LOUNGE METAL SIGN",2,12/1/2010 9:41,2.1,15311,United Kingdom
Since the program being used has not been specifically mentioned, a general solution would be to parse first, replace the comma with space, and save again as a csv file.
As an example, I would open this CSV in Excel, Use REPLACE to replace the "'" with " ", and then save again as a CSV.
Same could be done with any programming language which can parse a CSV.
If you are using any programming language to extract this record then you might use the replace operation to remove "," with the space.
Like in Java String.replace(","," ");
I am using a simple program to read CSV file, somehow I noticed when I created a CSV using EXCEL or windows based computer go library fails to read it. even when I use cat command it only shows me last line on the terminal. It always results in this error extraneous " in field.
I researched somewhat than I found it is somewhat related to carriage return differences between OS.
But I really want to ask how to make a generic csv reader. I tried reading the same csv using pandas and it was reading successfully. But i am not been able to achieve this using my Go code.
Also screen shot of correct csv Is here
Your file clearly shows that you've got an extra quote at the end of the content. While programs like pandas may be fine with that, I assume it's not valid csv so go does return an error.
Quick example of what's wrong with your data: https://play.golang.org/p/KBikSc1nzD
Update: After your update and a little bit of searching, I have to apoligize, the carriage return does matter and seems to be tha main culprit here, Go seems to be ok handling the \r\n windows variant but not the \r one. In that case what you can do is wrap the bytes.Reader into a custom reader that replaces the \r byte with the \n byte.
Here's an example: https://play.golang.org/p/vNjzwAHmtg
Please note, that the example is just that, an example, it's not handling all the possible cases where \r might be a legit byte.
I am using a COPY with ACCEPTINVCHARS to load a CSV into Amazon Redshift.
Unfortunately I get errors like
Missing newline: Unexpected character 0x69 found at location 129
However, if I try to use the ESCAPE option as well, I get the exception
CSV is not compatible with ESCAPE
What am I supposed to do in order to COPY this into Redshift? I'm fine if the chars get replaced with ? or whatever.
Ignore the header as the headers might not be of the same datatype as your fields.
Use IGNOREHEADER AS
Refer to the forum for more details,
https://forums.aws.amazon.com/thread.jspa?messageID=557452
For future generations, "CSV is not compatible with ESCAPE" is probably right but you don't actually need the CSV keyword to load CSV, so it's worth trying to remove the CSV keyword from your copy command.