UiPath Documentation
studiox
2024.10
true
Important :
Veuillez noter que ce contenu a été localisé en partie à l’aide de la traduction automatique. La localisation du contenu nouvellement publié peut prendre 1 à 2 semaines avant d’être disponible.
UiPath logo, featuring letters U and I in white

StudioX user guide

Dernière mise à jour 30 avr. 2026

Tutoriel : ajout d’informations sur les fichiers d'un dossier dans un fichier Excel

Dans ce tutoriel, nous allons créer une automatisation qui permet de récupérer le nom et la taille de tous les fichiers d'un dossier et d'ajouter ces informations dans un fichier Excel.

We will create a project and start by adding a Use Excel File activity to indicate the Excel file to use. We will then add a For Each File In Folder activity to indicate the folder from which to retrieve file information. Inside For Each File in Folder, we will add two Write Cell activities, one to copy the name, the other to copy the size of each file to two cells in the Project Notebook. We will finish by adding an Append Range activity that appends the two cells to a range in an Excel file after the cells are populated for each file.

  1. Configurez un projet et créez un fichier Excel dans le dossier du projet.
    1. Create a new blank project using the default settings.
    2. Créez un fichier Excel dans le dossier du projet et nommez-le fichiers.xlsx.
    3. Ouvrez le fichier nouvellement créé dans Excel et entrez le texte File Name dans la cellule A1 et le texte File Size dans la cellule B1.
    4. Enregistrez et fermez les fichiers.xlsx.
  2. Ajoutez le fichier Excel au projet et indiquez le dossier dont les fichiers peuvent être parcourus.
    1. Dans le panneau Activités de StudioX, sélectionnez l’onglet Excel, puis double-cliquez sur Utiliser un fichier Excel. Une activité Utiliser un fichier Excel est ajoutée au panneau Concepteur.

    2. Dans l’activité Utiliser un fichier Excel :

      • Click Browse image des documents next to the Excel file field, and then browse to and select the file files.xlsx.
      • Dans le champ Référencer en tant que, entrez NamesSizes.
    3. Dans le panneau Activités, sélectionnez l’onglet Fichier, puis faites glisser l’activité Pour chaque fichier du dossier et déposez-la à l’intérieur de l’activité Utiliser un fichier Excel.

    4. In the For Each File in Folder activity, click Browse image des documents next to the In folder field, and then browse to and select a folder on your computer which contains files, for example the Desktop.

      image des documents

  3. Copiez les informations sur les fichiers vers le fichier Excel.
    1. Dans le panneau Activités, sélectionnez l’onglet Excel, puis faites glisser une activité Écrire la cellule et déposez-la à l’intérieur de l'activité Pour chaque fichier du dossier.

    2. Dans l’activité Écrire la cellule (Write Cell) :

      • Click Plus image des documents on the right side of the What to write field, and then select CurrentFile > Name to indicate that we want to copy the name of the current file in the iteration.
      • Click Plus image des documents on the right side of the Where to write field, and then select Notebook > Indicate in Excel to open the Project Notebook. In the file, select the A1 cell in the Scratchpad sheet, and click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to paste the name of the current file in the iteration to cell A1 in the Scratchpad sheet of the Project Notebook.
    3. Ajoutez une deuxième activité Écrire la cellule en dessous de la première activité.

    4. Dans l’activité Écrire la cellule (Write Cell) :

      • Click Plus image des documents on the right side of the What to write field, and then select CurrentFile > Size to indicate that we want to copy the size (in bytes) of the current file in the iteration.
      • Click Plus image des documents on the right side of the Where to write field, and then select Notebook > Indicate in Excel to open the Project Notebook. In the file, select the B1 cell in the Scratchpad sheet, and click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to paste the size of the current file in the iteration to cell B1 in the Scratchpad sheet of the NamesSizes Excel file.
    5. Pour rendre les deux activités Écrire la cellule plus facilement identifiables, modifiez le nom dans la barre supérieure de chacune d’entre elle. Par exemple, utilisez Write Cell Name pour la première activité et Write Cell Size pour la seconde.

    6. Dans le panneau Activités, faites glisser une activité Ajouter la plage et déposez-la à l’intérieur de l'activité Pour chaque fichier du dossier en dessous de la deuxième activité Écrire la cellule.

    7. Dans l’activité Ajouter la plage (Append Range) :

      • Click Plus image des documents on the right side of the Append after range field and then select NamesSizes > Sheet1.

      • Click Plus docs image on the right side of the Excel range to append field, and then select Notebook > Indicate in Excel to open the file in Excel. In the file, select the A1:B1 cells and click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to add the information about the current file in the iteration to columns A and B in the NamesSizes file after the existing data in the file.

        image des documents

    8. Cliquez sur Enregistrer dans le ruban StudioX pour enregistrer l’automatisation, puis cliquez sur Exécuter pour exécuter l’automatisation.

      The name and size of each file in the indicated folder are copied one by one to cells A1 and A2 in the Scratchpad sheet of the Project Notebook, and then appended to files.xlsx.Download example

Cette page vous a-t-elle été utile ?

Connecter

Besoin d'aide ? Assistance

Vous souhaitez apprendre ? UiPath Academy

Vous avez des questions ? UiPath Forum

Rester à jour