Excluir linhas do excel que possuem células com valor específico

Olá, tenho uma planilha excel que precisa ser limpa todo dia 01 do mês. Todo dia 01 eu preciso excluir os dados do mês anterior.
Exemplo: No dia 01 de dezembro eu preciso excluir todas as linhas que contenham células com valores “03/11/2023”. Gostaria de saber quais atividades eu preciso incrementar pra ler a linha e excluir ela caso tenha o valor do mês anterior.

Sou novo com UiPath e estou tentando aprender, espero que consigam me ajudar. Obrigado!

@YanN

Why not use a empty template file and at on the first run of the month replace the file with the empty template

To identify first run you can add asset and write the run date at the end of the process and at the dtart of the process get the asset value and check if the month is equal to the current month

Now.Month.Equals(Cdate(str).Month)

Cheers

Hi @YanN

Try the below process:
=> Use Read Range Workbook to read the excel and store the output in a datatable variable dt.
=> Use the below syntax in Assign activity:

dt= dt.AsEnumerable().Where(Function(row) DateTime.ParseExact(row("Date").ToString(), "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture).Month <> DateTime.Now.AddMonths(-1).Month).CopyToDataTable()

=> Use Write Range Workbook to write the data back to excel.

Assuming the input to be like this:


Output:

Workflow:

xaml:
Sequence3.xaml (7.8 KB)

Regards

Thank you for your help

1 Like

Thank you for your help!!

1 Like

Hi @YanN

If you find the solution for your query please mark it as solution to close the topic. Happy to have helped.

Happy Automation

Regards