I want to delete the first row (row 1) and Column “E” from a downloaded CSV file.
The problem I have is the file name changes each time it’s downloaded so I use a For Loop to open the most recent file. The “Delete Row” activity requires the file name which I don’t have because it changes each time
Hello @michael.murphy welcome to Uipath Forum I would like to help you, but I just have some question
1- From where do you download the file?
2- is the file save always in the download folder?
3- Can you share de CSV file to create a Workflow?
1- The file is downloaded from Tableau as a CSV.
2 - Yes the file is always saved to the download folder
3 - I got an error when I tried to upload that it couldn’t upload a csv file.
Processing: Agent_Performance_for_UL_-_Expanded__crosstab (9).csv…
I’m sure that if you have a process for an excel file it would work as well.
Well I have two solutions in mind the first one is to get the last file in download folder
Can you please try to use this step first instead of the LOOP
1- Click or what you do to download the file
2- In the property “delayafter” of the Click add a delay to wait the download (if it is neccesary)
3- Add an Assing activity with the following values
StringPathLastFile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + “\Downloads”).OrderByDescending(Function(x) new FileInfo(x).LastWriteTime)(0)
*The number step numer 3 it’s to get the last file from the download folder
4- Use the Variable to read the File in the Delete Row or whetever you need it
The seconf solution is tou use an activity called “Wait for Download”, but please try the first solution, and let me know if that works, if not I will explain to you the second
Sorry, I should have added that I already have the file open by using “For Each File” loop activity to open it from the download folder so it has the focus. The problem is the “Delete Rows” activity wants a file name in the “in what table or range” field so I don’t know what to put in that field to satisfy it.
Thank you for your help
Hello I create a another solution, can you try and let me know what you think
Delete Row CSV.xaml (8.8 KB)
You only need to write the CSV path and the path where you want to save the data Processed
You could try something like this:
Thank you, I will try that and let you know how it turns out.
I’m sorry, I wasn’t able to download the file. Can you send a screenshot instead?
Sure, first Read the CSV and the Remove the Column:
The convert the table to be able to remove the first row
This is the configuration for the Generate table:
Finally, convert again the Table text to DataTable
Let me know any doubt