How to Change the cell format into text format in .csv file

Suggest a method to do it.

@Gopikrishna_S Can you share sample csv. Also, is it Okay if this can be converted to excel or do you want to keep only CSV format

Screenshot 2022-04-28 122233
I need to print like this 10E001 in B1 cell but I am getting like this 100 in B1 cell so I changed E1 cell format into string then i entered this value have got what i want.

is this not working for CSV file?

I am using the Invoke code inside the excel application scope but in write csv activity how to use invoke code activity

@Gopikrishna_S Check below workflow

Example.zip (3.0 KB)

Make sure pass sheet name and column name in the Invoke VBA acitivyt within code

Capture5

Before running this workflow make sure you open excel and follow below steps

  • Click on Options
    Capture

  • Click on Trust Center
    Capture1

  • Click on Trust Center Settings
    Capture2

  • Click on Macro Settings
    Capture3

  • Make sure you enable Turst access to VBA Project Model
    Capture4

that only works for xlsx

i think if you dont convert to xlsx,
you can add vbTab after your number when you write cell
image

then it will be normal in the result csv
image

But i am not using write cell, i am using write range how to apply this method for write range

before you write range, call this sequence
Append Tab To Dt.xaml (7.7 KB)

pass in dt variable

1 Like

Hello,

Did you tried Format Cell Activity? You can define a Range the format that you want to keep.
image

Super Its Working, Cold you please explain how its working what is the logic behind this.

1 Like

this loops through each row for a column and add tab character to each cell
dt.AsEnumerable().ToList().ForEach(Sub(row) row(colName)= row(colName).ToString+vbTab)

i loop over each column to call the code above so that it will effectively add tab character to each cell

@Gopikrishna_S It did work for CSV as well . I have tested it. Anyways Thank you

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.