UiPath Documentation
studiox
2021.10
false
Guia do usuário do StudioX
Importante :
A localização de um conteúdo recém-publicado pode levar de 1 a 2 semanas para ficar disponível.

Tutorial: Filtrar dados no Excel

Neste tutorial, criaremos uma automação para o seguinte processo:

  1. Copiar os dados de uma planilha com informações do fornecedor para uma nova planilha.
  2. Filtrar os dados para mostrar apenas as linhas com fornecedores dos setores Serviços e TI que foram adicionados nos últimos 10 anos.
  3. Copiar os dados filtrados para um arquivo CSV.
  4. Enviar o arquivo CSV por e-mail.

Vamos criar um projeto com as seguintes atividades:

  • Uma atividade Use Excel File para indicar o arquivo do Excel com informações do fornecedor.
  • A Copy Range activity to copy the data to another sheet.
  • Duas atividades Filter para filtrar os dados de acordo com os critérios desejados: um filtro para a coluna Setor e outro para a coluna Fornecedor desde .
  • Uma atividade Write CSV para copiar os dados filtrados para um arquivo CSV.
  • Uma atividade Use Desktop Outlook App para indicar a conta do Outlook da qual enviar o e-mail.
  • Uma atividade Send Email para enviar o e-mail.
  1. Etapa 1: Configure o projeto e obtenha os arquivos necessários.

    1. Create a new blank project using the default settings.
    2. Baixe e extraia o arquivo com o projeto de automação neste tutorial usando o botão na parte inferior desta página. Copie o arquivo Suppliers.xlsx para sua pasta do projeto.
  2. Etapa 2: Adicione o arquivo do Excel ao projeto.

    1. Click Add activity Imagem dos documentos in the Designer panel, and then find the Use Excel File activity in the search box at the top of the screen and select it. A Use Excel File activity is added to the Designer panel.

    2. Na atividade:

      • Click BrowseImagem dos documentos next to the Excel file field, and then browse to and select the file Suppliers.xlsx

      • No campo Referenciar como, insira Suppliers.

        Com isso você indica que irá trabalhar com o arquivo Suppliers.xlsx que é conhecido em sua automação como Suppliers.

  3. Etapa 3: Filtrar os dados e copiá-los para um arquivo CSV.

    1. Click Add activity Imagem dos documentos inside the Use Excel File and then, in the search box at the top of the screen, locate and select Copy Range. A Copy Range activity is added to the Designer panel.

    2. Na atividade Copy Range:

      • Click PlusImagem dos documentos on the right side of the Source range field, and then select Suppliers > Data [Sheet].

      • Click Plus Imagem dos documentos on the right side of the Destination range field, and then select Suppliers > Processed [Sheet].

        Você indicou que deseja copiar os dados da planilha Data no arquivo Suppliers e colá-los na planilha Processed do mesmo arquivo.

    3. Clique em Salvar na faixa de opções do StudioX para salvar a automação e, então, clique em Executar para executar a automação.

      Os dados são copiados da planilha Data para a planilha Processed na pasta de trabalho Suppliers.

    4. Click Add activity Imagem dos documentos inside the Use Excel File just below the Copy Range activity, and then, in the search box at the top of the screen, locate and select Filter. A Filter activity is added to the Designer panel.

    5. Na atividade Filter:

      • Click PlusImagem dos documentos on the right side of the Source range field, and then select Suppliers > Processed [Sheet].
      • Click PlusImagem dos documentos on the right side of the Column name field, and then select Range > Industry.
      • Clique no botão Configurar filtro. Na janela Filter, certifique-se de que Filtro básico esteja selecionado e, então:
        • Click PlusImagem dos documentos on the right side of the Value field, and then select Text. In the Text Builder, enter Services, and then click Save.

        • ClickAdd to add a second value.

        • Clique em Mais Imagem dos documentos no lado direito do segundo campo Valor e, em seguida, selecione Texto. No Construtor de Texto, insira IT e, em seguida, clique em Salvar e então clique em OK para fechar a janela Filtrar.

          Você indicou que deseja filtrar os dados na planilha Processed para exibir apenas as linhas com os valores Serviços ou TI na coluna Industry.

    6. Click Add activity Imagem dos documentos inside the Use Excel File just below the Filter activity, and then, in the search box at the top of the screen, locate and select Filter. A second Filter activity is added to the Designer panel.

    7. Na segunda atividade Filter:

      • Click PlusImagem dos documentos on the right side of the Source range field, and then select Suppliers > Processed [Sheet].
      • Click PlusImagem dos documentos on the right side of the Column name field, and then select Range > Supplier Since.
      • Clique no botão Filtrar. Na janela Filtrar:
        • Select Advanced filter.

        • No menu suspenso Operador, selecione > (é maior que).

        • Clique em Mais Imagem dos documentos no lado direito do campo Valor e, em seguida, selecione Texto. No Construtor de Texto, insira uma data de até 10 anos atrás, como por exemplo, 5/5/2009, em seguida clique em Salvar e, então, clique em OK para fechar a janela Filter.

          Você indicou que deseja filtrar os dados na planilha Processed para exibir apenas as linhas com datas após 5/5/2009 na coluna Supplier Since.

    8. Para tornar os filtros mais facilmente identificáveis, edite o nome na barra superior de cada um. Por exemplo, use Filter Industry para o primeiro e Filter Supplier Since para o segundo.

    9. Click Add activity Imagem dos documentos just below the Use Excel File activity, and then, in the search box at the top of the screen, locate and select Write CSV. A Write CSV activity is added to the Designer panel. Alternatively, you can also add this activity inside the Use Excel File activity, just below the last Filter activity.

    10. Na atividade Write CSV:

      • Click PlusImagem dos documentos on the right side of the Write to what file field, and then select Text. In the Text Builder, enter result-, and then from the PlusImagem dos documentos menu on the right side of the Text Builder select Project Notebook (Notes) > Date [Sheet] > YYYYMMDD [Cell]. The text in the Text Builder is updated to result-Excel Date!YYYYMMDD. Enter the text .csv at the end and click Save. The final text should be result-Excel Date!YYYYMMDD.csv.

      • Click PlusImagem dos documentos on the right side of the Write from field, and then select Suppliers > Processed [Sheet].

        Você indicou que deseja criar um arquivo CSV na pasta do projeto cujo nome contém o texto resultante e a data de hoje, e que deseja copiar nele os dados na planilha Processed.

  4. Etapa 4: Enviar o arquivo CSV por e-mail.

    Os dados na planilha Processed são filtrados e, então, copiados para um arquivo CSV com a data de hoje no nome; depois, o arquivo CSV é enviado por e-mail.

    1. Click Add activity Imagem dos documentos below the Use Excel File activity, and then find the Use Desktop Outlook App activity in the search box at the top of the screen and select it. A Use Desktop Outlook App activity is added to the Designer panel.

    2. Na atividade, a conta de e-mail padrão já está selecionada no campo Conta. Se você quiser usar uma conta diferente, selecione-a no menu suspenso.

      Na campo Referenciar como, deixe o valor padrão Outlook como o nome pelo qual se referir à conta na automação.

    3. Click Add activity Imagem dos documentos inside theUse Desktop Outlook App activity, and then, in the search box at the top of the screen, locate and select Send Email. A Send Email activity is added to the Designer panel.

    4. Na atividade Send Email:

      • Click PlusImagem dos documentos on the right side of the From account field, and then select Outlook.

      • Click PlusImagem dos documentos on the right side of the To field, and then select Text. In the Text Builder window, enter an email address where to send the email. For example, you can enter your own email address to send the email to yourself. If you leave the Is draft option selected, the automation does not send the email, it instead saves the email to the Outlook Drafts folder.

      • Click PlusImagem dos documentos on the right side of the Subject field, and then select Text. In the Text Builder window, enter List of filtered suppliers for, and then, from the PlusImagem dos documentos menu on the right side of the Text Builder, select Project Notebook (Notes) > Date [Sheet] > Today [Cell]. The final text should look like this: List of filtered suppliers for [Excel]Date!Today. Click Save to close the Text Builder.

      • Click PlusImagem dos documentos on the right side of the Body field, and then select Text. In the Text Builder window, enter text for the body of the email, for example Please see attachment.

      • Para Anexos, selecione Arquivos e clique em Mais Imagem dos documentos no lado direito do campo e, em seguida, selecione Texto. No Construtor de Texto, insira o nome do arquivo da mesma maneira que inseriu na atividade Write CSV: result-Excel Date!YYYYMMDD.csv. Uma maneira de fazer isso é selecionar todo o texto no Construtor de Texto do campo Escrever em qual arquivo na atividade Write CSV, copiar o texto e, em seguida, colá-lo no Construtor de Texto do campo Anexos.

    5. Clique em Salvar na faixa de opções do StudioX para salvar a automação e, em seguida, clique em Executar para executar a automação.

Esta página foi útil?

Conectar

Precisa de ajuda? Suporte

Quer aprender? Academia UiPath

Tem perguntas? Fórum do UiPath

Fique por dentro das novidades