.. _load multiple files:

Load Multiple Files
===================

.. container:: lang-en

   Loads several data files from one or more folders, checks that all of them
   share the same column structure and merges them into a single table. It is
   the natural companion of **Events Fusion**: it loads all the ``bio-*.csv``
   (or all the ``wea_*.csv``) at once instead of one **File** widget per file.

   Formats: CSV, TSV/TAB (delimiter detected automatically), XLSX/XLS (sheet
   chosen per file) and ARFF.

   **Output — Data**: the merge of all files, with the columns in the order of
   the first file and a meta column (``ARCHIVO`` by default) with the source
   file name without extension. In **Events Fusion** that column is chosen as
   the *spot column* (for the ``bio`` files) or the *station column* (for the
   ``wea`` files).

   **Usage**

   1. *Add files...* opens the explorer with multiple selection; repeat as
      needed. *Add folder with the pattern...* adds every file of a folder
      matching the pattern (e.g. ``bio-*.csv``).
   2. Each file appears in the table with its status — **OK**, **Warning** or
      **Error** — and a tooltip explaining why (missing or extra columns,
      different order, incompatible type, unreadable file). The first valid
      file is the reference the others are compared with.
   3. For XLSX files the sheet can be changed in the table.
   4. *Remove selected* / *Clear* drop files from the list; *Re-check*
      reloads all of them.
   5. *Send* is only enabled when there are no errors.

   **Structure check**

   - *Same column order*: required by default. If unchecked, files with the
     same columns in a different order are reordered (warning).
   - *Types*: by default type *families* are compared (numeric,
     text/categorical, date), because Orange infers the type per file and a
     numeric column with few distinct values may come out as "discrete" in one
     file and "numeric" in another. *Require identical Orange types* applies
     the strict comparison.
   - When merging, numeric columns (including discrete ones with numeric
     values) are emitted as numeric; categorical ones as discrete with the
     union of values; if any file brings them as text, as text.

   The file list is saved with the workflow and reloaded when it is opened.

.. container:: lang-es

   Carga varios archivos de datos de una o varias carpetas, comprueba que
   todos comparten la misma estructura de columnas y los fusiona en una única
   tabla. Es el complemento natural de **Events Fusion**: permite cargar de
   una vez todos los ``bio-*.csv`` (o todos los ``wea_*.csv``) en lugar de un
   widget **File** por archivo.

   Formatos: CSV, TSV/TAB (delimitador detectado automáticamente), XLSX/XLS
   (con elección de hoja por archivo) y ARFF.

   **Salida — Data**: la fusión de todos los archivos, con las columnas en el
   orden del primero y una columna metadato (por defecto ``ARCHIVO``) con el
   nombre del archivo de origen sin extensión. En **Events Fusion** esa
   columna se elige como *columna de spot* (para los ``bio``) o *columna de
   estación* (para los ``wea``).

   **Uso**

   1. *Añadir archivos...* abre el explorador con selección múltiple; se puede
      repetir. *Añadir carpeta con el patrón...* añade todos los archivos de
      una carpeta que cumplan el patrón (p. ej. ``bio-*.csv``).
   2. Cada archivo aparece en la tabla con su estado — **OK**, **Aviso** o
      **Error** — y un tooltip que explica el motivo (columnas que faltan o
      sobran, distinto orden, tipo incompatible, archivo ilegible). El primer
      archivo válido es la referencia con la que se comparan los demás.
   3. Para los XLSX se puede cambiar la hoja en la propia tabla.
   4. *Eliminar seleccionados* / *Vaciar* quitan archivos de la lista;
      *Volver a comprobar* relee todos.
   5. *Enviar* solo se activa cuando no hay errores.

   **Comprobación de estructura**

   - *Mismo orden de columnas*: exigido por defecto. Si se desmarca, los
     archivos con las mismas columnas en otro orden se reordenan (aviso).
   - *Tipos*: por defecto se comparan *familias* de tipo (numérico,
     texto/categórico, fecha), porque Orange infiere el tipo por archivo y una
     columna numérica con pocos valores distintos puede salir "discreta" en un
     archivo y "numérica" en otro. *Exigir tipos de Orange idénticos* aplica
     la comparación estricta.
   - En la fusión, las columnas numéricas (incluidas las discretas con valores
     numéricos) se emiten como numéricas; las categóricas, como discretas con
     la unión de valores; si algún archivo las trae como texto, como texto.

   La lista de archivos se guarda con el flujo de trabajo y se relee al
   abrirlo.
