Hi team,
I have lakh of data in csv file and that file converting into text file and that file I’m reading then splitting that data into 200000 lakh after split i used for each and split variable pass in for each then i used string.join(“,”,item)
Then I’m getting output as i shown in below image
And i get output like column1,column2, column3,column4… Like this
Note :- my text file is already seperated with comma so no need to use modify or replace
Thanks
Anil_G
(Anil Gorthi)
October 6, 2024, 4:23pm
2
@suraj_gaikwad
Then directly use generate datatable activity
Cheers
Hi
I used that only inside for each
@Anil_G
Anil_G
(Anil Gorthi)
October 6, 2024, 4:26pm
4
@suraj_gaikwad
Can you show a screenshot of what you are doing
One way you can do is
Dt = Str.Split({Environment.NewLine},StringSplitOptions.None).Select(function(x) dt.LoadDataRow(x.Split(","c),False)).CopyToDatatable
Dt to be initialized and str is the actual string
Cheers
Anil_G
(Anil Gorthi)
October 6, 2024, 4:40pm
6
@suraj_gaikwad
You dont need a for each or anything
First can you llease show your inlut and what you want to do with it
I hope you are getting a string and you want to convert to datatable is that the ask?
Cheers
Anil_G
(Anil Gorthi)
October 6, 2024, 4:55pm
8
@suraj_gaikwad
It would be great if you can explain what you are teying to do…
What si the input and expected output
As the screenshots has so many thing syou are trying to do
Is the ask to split the data into smaller chunks? Is the data comi g as string or datatable
Cheers
Yes right, input is text file there is lakh of data and i have to write in excel with headers which seperate with commas
Some time output coming like qhen i add split in small quantity
@Anil_G
Thanks
Anil_G
(Anil Gorthi)
October 6, 2024, 5:08pm
10
@suraj_gaikwad
Just reqd text file then use the expression below in assign…before that initialize datatable using new datatable()
Dt = Str.Split({Environment.NewLine},StringSplitOptions.None).Select(function(x) dt.LoadDataRow(x.Split(","c),False)).CopyToDatatable
No need or loop or anything
The assumption here is rows are separated by newline and columns are separated by comma
Cheers
Okay , I’m reading text file var os in array
System.io.readalllines(filepath)
@Anil_G
Anil_G
(Anil Gorthi)
October 6, 2024, 5:21pm
12
@suraj_gaikwad
Then use this
Dt = arrayvarible.Select(function(x) dt.LoadDataRow(x.Split(","c),False)).CopyToDatatable
Cheers
It will be work fo 30/40 lack of data bcz it’s giving error
@Anil_G
Anil_G
(Anil Gorthi)
October 6, 2024, 5:39pm
14
@suraj_gaikwad
Did you intialize the datatable?
As per error variable is null or not initialized
Dt and testdt should be same not different variables
Cheers