Many excel files

excel
activities

#1

Hello,

Nice to be here with all of you.
I am a new user in the community of Uipath and I want to make a question.
How can I take data from many excel files (~400)and drop them to a new excel file or in a txt file with specific format?


#2

Hi perpe,

I believe the steps you need to take are as follows:

  1. arrFiles = System.IO.Directory.GetFiles(path) which will give you an array< string > of all the excel filenames in the directory
  2. ForEach file In arrFiles (with type argument as String) to loop through each filename
  3. Excel Scope of file, with Read Range inside - store to dt as datatable type
  4. Create file and append data which differs based on if you want Excel or Text file
    • for Excel, Excel Scope to new filename, either Append Range activity or Read Range inside to store current data to dt2 to get last row by using dt2.Rows.Count to be used in Write Range with dt
    • for Text or CSV, Output Data Table activity with dt to a string variable and replace characters if needed for formatting, Read Text File of new file to get current data, Assign fulldata = fulldata + system.environment.newline + partdata in order to append the text together, Write Text File to .txt, .CSV, or preferred text-based file extension.

Hope this gives you some ideas :stuck_out_tongue:

Regards,

C