Dears,
See attached excel file.
Currently I have a task to copy column A,B,C of this file(include headers) and save it into a new text file.
I only want to copy column A,B,C, not other columns, and the total cell numbers of each column is not fixed, so it’s not proper to set read range from A1 to a exact C cell.
After reading the range, I use a write text activity and change it to string, but it doesn’t work.
Pls help me on this.
use assign dt_2=dt_1.DefaultView.ToTable(false,“ColumnName1”,“ColumnName2”) to select particular columns.
3.Use Output Datatable Activity to convert datatable into text.
4.Write into text file using Write Text File Activity
Dear Shubham_Varshney,
Perfect, it works!
It’s a very clever way to get the number of cells.
Let me share the key point here. Read Range to datatableA, range all. Assign Value=datatableA.rows.count Read Range to datatable B, range “A1:C”+Value
And for excel to text, Output Data Table can convert the datatable to a text.
Dear,
I tried your method, but I met two problems.
No.1 It only copy 2 columns instead of what I want 3 columns, I re-set as 3 columns, it’s ok.
No.2 The converted text contains a “,” between columns, which I don’t need. I need the text be displayed in notepad exactly like it in the original form.
Dear,
By using your workflow there’s still a little trouble, pls help to advise the solution.
The converted text contains a “,” between columns, which I don’t need. I need the text be displayed in notepad exactly like it in the original form.
Thanks a lot.
But I’m sorry to bother you again, because there’s still a minor problem.
How to keep the excel layout when we insert the value into the notepad?
This is the result get by above method.
NC1CNKG8KR6AG40105AA220XX51
NC1CNKG8QX6AG40105AA220XX51
NC1CNKG99H6AG40105AA220XX51
And below is the result we can get by manual Ctril C+Ctril V the excel range.
NC1CNKG8KR 6AG40105AA220XX5 1
NC1CNKG8QX 6AG40105AA220XX5 1
NC1CNKG99H 6AG40105AA220XX5 1
Dear,
Thank you for your reply.
Yes, this method can remove the “,”, but my current problem is that it can’t keep the original format in excel. Therefore it doesn’t work when I use the text file to upload to SAP.
You know, this is not a problem just to put some space " " into the quote, it’s a problem of format, excel always come with a structured format divided by cells.
Do you have any ideas about this?
Dear,
Another problem.
When I run the workflow based on your count row method, the text always can’t get the last row.
E.g, I have 1720rows, set range"A2:C"+value(I don’t need the headers), it only returns 1719 rows, can’t get the data of last row.
Pls help to check, thks.
Dear,
See my screen capture, what I need is the OK.txt, but if we set a fixed number of space value we will get NG.txt.
This is like the “left align” function in the excel file, while the value length of each column is different, so we can not just put a fixed number of space to achieve this.
Do you have any idea how to fix this?