How can i parse blob into table with NVARCHAR2 columns - parsing

Im using APEX21.2, and i want to parse a BLOB, which is the content of a .csv file (with separator type ';') containing Japanese characters) into an import table with NVARCHA2 columns, so that he knows the Japanese character.
Here is the content of my csv file
列 01;;;;列 05;列 06;;;;;;;;;;ぜんすう;
Column 01;Column 02;Column 03;Column 04;Column 05;Column 06;TOTAL;;;;;;;;;;
;123 A;T12345678;AZERT;QWERTY;;7000;;;;;;;;;;
NB: I already tried with the APEX_DATA_PARSER package, but it does not support strings of type NVARCHAR2
Thank you for help.

Related

Reading CSV by using java 8

string s and string c and string c represents a table in csv (comma separated) format) where rows are separated by newline characters and each rows consist of one or more fields separated by commas by using java 8 and String s is represent by csv data.How to read this in java 8 and as well get the maximum number in third column.

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 ...

Google Sheets - Function to split a string into columns

I have a column containing strings of emojis with no space in between of various lengths on Sheets and I would like to split them into separate columns each containing just one emoji.
Examples:
Input 😍💙💛
Output 😍|💙|💛
Sheets doesn't have the split to fixed width function unlike Excel, and can't use Excel because certain emojis are rendered incorrectly.
Assuming emojis in A1, try
=split(regexreplace(A1, "(.)", "_$1"), "_")
and see if that works?

Replace text after importData function

I am using importData function in Google Spreadsheet to import an external csv file. It works, but I want to replace some text in the table.
If am not wrong for replacing text there is a function:
SUBSTITUTE("search for it","search for","Google")
The problem: when I am trying to use SUBSTITUTE I get error:
Array result was not expanded because it would overwrite data in A3
Is there any way to import csv and replace text in the document?
You can use arrayformula and substitute along with importdata to replace or remove data. For example, I used this to replace '=" and double quotes with blanks:
=arrayformula(substitute(SUBSTITUTE( IMPORTDATA("https://ct.thecmp.org/app/v1/index.php?do=match&task=downloadMatchResultsDetail&MatchId=12504&EventId=4&AwardId=1") ,char(61) , "" ),char(34),""))

Joining two Pandas DataFrames does not work anymore?

I have 2 Pandas Dataframes.
The first one looks like this:
date rank id points
2010-01-04 1 100001 10550
2010-01-04 2 100002 9205
The second one like this:
id name
100001 A
100002 B
I want to join both dataframes via the id column. So the result should look like:
date rank id points name
2010-01-04 1 100001 10550 A
2010-01-04 2 100002 9205 B
Some weeks ago I wrote code for that, but for some reason it does not work anymore. I end up with an empty dataframe after I execute this code for joining:
join = pd.merge(df1,df2, on='id')
Why is join empty?
short story: as pointed out in the comment already, i was comparing strings with integers.
long story: i didn't expect python to parse the id-columns of two input csv files to different datatpyes. df1.id was of type Object. df2.id was of type int. and i needed to find out why df1.id was parsed to Object and not automatically to int, because it only contained numbers.
turns out that it had something to do with the encoding of my CSV file. in notepad++ the file was encoded as plain UTF-8. it seems that pandas did not like this, because when i tried to convert the id column to int, it raised an error like ValueError: invalid literal for int() with base 10: '\ufeff100001'. The number 100001 is the first ID of the first row. So there seems to be some encoded character before this number (at the very beginning of the file) \ufeff that prevented pandas to parse the whole column as int. in notepad++ i then changed the encoding of the file to UTF-8 without BOM and then everything worked.

Resources