Repository: apache/streampipes
Pull request #3452 (2025-01-31 12:43:03)

feat(#3448): Add excel export feature
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

  <!--
Thanks for contributing! Here are some tips you can follow to help us incorporate your contribution quickly and easily:
1. If this is your first time, please read our contributor guidelines:
    - https://streampipes.apache.org/community/get-involved/
    - https://cwiki.apache.org/confluence/display/STREAMPIPES/Getting+Started
2. Make sure the PR title is formatted like: `[#<GitHub issue id>] PR title ...`
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., `[WIP][#<GitHub issue id>] PR title ...`.
4. Please write your PR title to summarize what this PR proposes/fixes.
5. Link the PR to the corresponding GitHub issue (if present) in the `Development` section in the right menu bar.
6. Be sure to keep the PR description updated to reflect all changes.
7. If possible, provide a concise example to reproduce the issue for a faster review.
8. Make sure tests pass via `mvn clean install`.
9. (Optional) If the contribution is large, please file an Apache ICLA
    - http://apache.org/licenses/icla.pdf
-->

### Purpose
<!--
Please clarify what changes you are proposing and describe how those changes will address the issue.
Furthermore, describe potential consequences the changes might have.
-->

Support Microsoft Excel as output format when exporting data from the time-series database.

### Remarks
<!--
Is there anything left we need to pay attention on?
Are there some references that might be important? E.g. links to Confluence, or discussions
on the mailing list or GitHub.
-->
PR introduces (a) breaking change(s): no

PR introduces (a) deprecation(s): no



Patch:
diff --git a/installer/cli/.env b/installer/cli/.env
index 8536887d28..149e8230cd 100644
--- a/installer/cli/.env
+++ b/installer/cli/.env
@@ -15,7 +15,6 @@
 
 SP_DOCKER_REGISTRY=apachestreampipes
 SP_VERSION=0.98.0-SNAPSHOT
-SP_SUBNET=172.31.0.0/16
 COMPOSE_PROJECT_NAME=streampipes
 
 # -------------------------------------------------------------
diff --git a/installer/cli/bin/commands/up b/installer/cli/bin/commands/up
index 2e2ee5d77b..de9b6a86ad 100755
--- a/installer/cli/bin/commands/up
+++ b/installer/cli/bin/commands/up
@@ -70,8 +70,7 @@ configure(){
 create_external_docker_network() {
 	if [ ! "$(docker network ls | grep spnet)" ]; then
 	  info "Creating docker network 'spnet'"
-    subnet=$(sed -n 's/^SP_SUBNET=//p' $STREAMPIPES_WORKDIR/.env)
-	  run "docker network create --driver=bridge --subnet=$subnet spnet" > /dev/null 2>&1
+	  run "docker network create --driver=bridge spnet" > /dev/null 2>&1
 	else
 	  info "Docker network 'spnet' already exists. Continuing"
 	fi
diff --git a/installer/compose/.env b/installer/compose/.env
index e8d067b38b..9cf2ad1f71 100644
--- a/installer/compose/.env
+++ b/installer/compose/.env
@@ -15,7 +15,6 @@
 
 SP_VERSION=0.98.0-SNAPSHOT
 SP_DOCKER_REGISTRY=apachestreampipes
-SP_SUBNET=172.31.0.0/16
 COMPOSE_PROJECT_NAME=streampipes
 
 # For database migration in v0.91.0 - set init mode to 'upgrade' to migrate an existing installation
diff --git a/installer/compose/docker-compose.full.yml b/installer/compose/docker-compose.full.yml
index 3ad4679ae4..2ad26d92cd 100644
--- a/installer/compose/docker-compose.full.yml
+++ b/installer/compose/docker-compose.full.yml
@@ -167,7 +167,3 @@ volumes:
 networks:
   spnet:
     driver: bridge
-    ipam:
-     config:
-       - subnet: ${SP_SUBNET}
-
diff --git a/installer/compose/docker-compose.minimal.yml b/installer/compose/docker-compose.minimal.yml
index 97267e3975..cc4944778c 100644
--- a/installer/compose/docker-compose.minimal.yml
+++ b/installer/compose/docker-compose.minimal.yml
@@ -93,7 +93,6 @@ services:
 
   extensions-iiot-minimal:
     image: "${SP_DOCKER_REGISTRY}/extensions-iiot-minimal:${SP_VERSION}"
-    depends_on:
     logging: *default-logging
     restart: unless-stopped
     networks:
@@ -110,7 +109,4 @@ volumes:
 networks:
   spnet:
     driver: bridge
-    ipam:
-      config:
-        - subnet: ${SP_SUBNET}
 
diff --git a/installer/compose/docker-compose.nats.yml b/installer/compose/docker-compose.nats.yml
index 3e7bb6a436..4c3fdefc9d 100644
--- a/installer/compose/docker-compose.nats.yml
+++ b/installer/compose/docker-compose.nats.yml
@@ -111,7 +111,4 @@ volumes:
 networks:
   spnet:
     driver: bridge
-    ipam:
-      config:
-        - subnet: ${SP_SUBNET}
 
diff --git a/installer/compose/docker-compose.pulsar.yml b/installer/compose/docker-compose.pulsar.yml
index 52c8d10137..1366e93990 100644
--- a/installer/compose/docker-compose.pulsar.yml
+++ b/installer/compose/docker-compose.pulsar.yml
@@ -106,7 +106,4 @@ volumes:
 networks:
   spnet:
     driver: bridge
-    ipam:
-      config:
-        - subnet: ${SP_SUBNET}
 
diff --git a/installer/compose/docker-compose.quickstart.yml b/installer/compose/docker-compose.quickstart.yml
index 1dde57faba..175d931f0d 100644
--- a/installer/compose/docker-compose.quickstart.yml
+++ b/installer/compose/docker-compose.quickstart.yml
@@ -152,6 +152,3 @@ volumes:
 networks:
   spnet:
     driver: bridge
-    ipam:
-      config:
-        - subnet: ${SP_SUBNET}
\ No newline at end of file
diff --git a/installer/compose/docker-compose.yml b/installer/compose/docker-compose.yml
index 7dd664af09..6157972476 100644
--- a/installer/compose/docker-compose.yml
+++ b/installer/compose/docker-compose.yml
@@ -142,7 +142,4 @@ volumes:
 networks:
   spnet:
     driver: bridge
-    ipam:
-     config:
-       - subnet: ${SP_SUBNET}
 
diff --git a/streampipes-data-explorer-export/pom.xml b/streampipes-data-explorer-export/pom.xml
index e108241836..2a14909f82 100644
--- a/streampipes-data-explorer-export/pom.xml
+++ b/streampipes-data-explorer-export/pom.xml
@@ -29,6 +29,10 @@
         This module contains all components and functionalities related to exporting data from the data explorer storage.
     </description>
 
+    <properties>
+        <apache-poi.version>5.4.0</apache-poi.version>
+    </properties>
+
     <dependencies>
         <!-- StreamPipes dependencies -->
         <dependency>
@@ -36,6 +40,39 @@
             <artifactId>streampipes-model</artifactId>
             <version>0.98.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.streampipes</groupId>
+            <artifactId>streampipes-storage-management</artifactId>
+            <version>0.98.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.streampipes</groupId>
+            <artifactId>streampipes-pipeline-management</artifactId>
+            <version>0.98.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>${apache-poi.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>${apache-poi.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
 
         <!-- Test dependencies -->
         <dependency>
@@ -44,11 +81,4 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-
-    <properties>
-        <maven.compiler.source>17</maven.compiler.source>
-        <maven.compiler.target>17</maven.compiler.target>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-</project>
\ No newline at end of file
+</project>
diff --git a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredCsvOutputWriter.java b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredCsvOutputWriter.java
index 0f78498656..cbc7eaba95 100644
--- a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredCsvOutputWriter.java
+++ b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredCsvOutputWriter.java
@@ -19,6 +19,7 @@
 package org.apache.streampipes.dataexplorer.export;
 
 import org.apache.streampipes.dataexplorer.export.item.CsvItemGenerator;
+import org.apache.streampipes.model.datalake.DataLakeMeasure;
 import org.apache.streampipes.model.datalake.param.ProvidedRestQueryParams;
 import org.apache.streampipes.model.datalake.param.SupportedRestQueryParams;
 
@@ -35,10 +36,18 @@ public class ConfiguredCsvOutputWriter extends ConfiguredOutputWriter {
 
   private CsvItemGenerator itemGenerator;
   private String delimiter = COMMA;
+  private DataLakeMeasure schema;
+  private String headerColumnNameStrategy;
 
   @Override
-  public void configure(ProvidedRestQueryParams params,
+  public void configure(DataLakeMeasure schema,
+                        ProvidedRestQueryParams params,
                         boolean ignoreMissingValues) {
+    this.schema = schema;
+    this.headerColumnNameStrategy = params
+        .getProvidedParams()
+        .getOrDefault(SupportedRestQueryParams.QP_HEADER_COLUMN_NAME, "key");
+
     if (params.has(SupportedRestQueryParams.QP_CSV_DELIMITER)) {
       delimiter = params.getAsString(SupportedRestQueryParams.QP_CSV_DELIMITER).equals("comma") ? COMMA : SEMICOLON;
     }
@@ -69,7 +78,7 @@ public class ConfiguredCsvOutputWriter extends ConfiguredOutputWriter {
 
   private String makeHeaderLine(List<String> columns) {
     StringJoiner joiner = new StringJoiner(this.delimiter);
-    columns.forEach(joiner::add);
+    columns.forEach(c -> joiner.add(getHeaderName(schema, c, headerColumnNameStrategy)));
     return joiner + LINE_SEPARATOR;
   }
 }
diff --git a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredExcelOutputWriter.java b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredExcelOutputWriter.java
new file mode 100644
index 0000000000..d349f391c9
--- /dev/null
+++ b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredExcelOutputWriter.java
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.streampipes.dataexplorer.export;
+
+import org.apache.streampipes.manager.file.FileManager;
+import org.apache.streampipes.model.datalake.DataLakeMeasure;
+import org.apache.streampipes.model.datalake.param.ProvidedRestQueryParams;
+import org.apache.streampipes.model.datalake.param.SupportedRestQueryParams;
+import org.apache.streampipes.model.file.FileMetadata;
+import org.apache.streampipes.storage.api.CRUDStorage;
+
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.util.List;
+import java.util.Objects;
+
+public class ConfiguredExcelOutputWriter extends ConfiguredOutputWriter {
+
+  private final CRUDStorage<FileMetadata> storage;
+
+  private SXSSFWorkbook wb;
+  private Sheet ws;
+  private boolean useTemplate = false;
+  private int startRow = 0;
+  private String templateId;
+  private DataLakeMeasure schema;
+  private String headerColumnNameStrategy;
+
+  public ConfiguredExcelOutputWriter(CRUDStorage<FileMetadata> fileMetadataStorage) {
+    this.storage = fileMetadataStorage;
+  }
+
+  @Override
+  public void configure(DataLakeMeasure schema,
+                        ProvidedRestQueryParams params,
+                        boolean ignoreMissingValues) {
+    var qp = params.getProvidedParams();
+    this.schema = schema;
+    this.headerColumnNameStrategy = qp.getOrDefault(SupportedRestQueryParams.QP_HEADER_COLUMN_NAME, "key");
+    if (qp.containsKey(SupportedRestQueryParams.QP_XLSX_USE_TEMPLATE)) {
+      this.useTemplate = true;
+      this.startRow = Integer.parseInt(qp.getOrDefault(SupportedRestQueryParams.QP_XLSX_START_ROW, "0"));
+      this.templateId = qp.getOrDefault(SupportedRestQueryParams.QP_XLSX_TEMPLATE_ID, null);
+    }
+  }
+
+  @Override
+  public void beforeFirstItem(OutputStream outputStream) {
+    if (useTemplate && Objects.nonNull(templateId)) {
+      var fileMetadata = storage.getElementById(templateId);
+      if (fileMetadata != null) {
+        var path = new FileManager().getFile(fileMetadata.getFilename()).getAbsoluteFile().toPath();
+        try (InputStream is = Files.newInputStream(path)) {
+          XSSFWorkbook templateWorkbook = new XSSFWorkbook(is);
+          wb = new SXSSFWorkbook(templateWorkbook);
+          ws = wb.getSheetAt(0);
+        } catch (IOException e) {
+          createNewWorkbook();
+        }
+      }
+    } else {
+      createNewWorkbook();
+    }
+  }
+
+  private void createNewWorkbook() {
+    wb = new SXSSFWorkbook();
+    ws = wb.createSheet();
+  }
+
+  @Override
+  public void afterLastItem(OutputStream outputStream) throws IOException {
+    wb.write(outputStream);
+    wb.close();
+  }
+
+  @Override
+  public void writeItem(OutputStream outputStream,
+                        List<Object> row,
+                        List<String> columnNames, boolean firstObject) throws IOException {
+    var excelRow = ws.createRow(startRow);
+    int columnIndex = 0;
+    if (firstObject) {
+      for (String column : columnNames) {
+        var cell = excelRow.createCell(columnIndex);
+        var headerName = getHeaderName(schema, String.valueOf(column), headerColumnNameStrategy);
+        cell.setCellValue(headerName);
+        columnIndex++;
+      }
+      startRow++;
+      excelRow = ws.createRow(startRow);
+      columnIndex = 0;
+    }
+    for (Object column : row) {
+      var cell = excelRow.createCell(columnIndex);
+      String entry = ExportUtils.formatValue(column);
+      cell.setCellValue(entry);
+      columnIndex++;
+    }
+    startRow++;
+  }
+}
diff --git a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredJsonOutputWriter.java b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredJsonOutputWriter.java
index d7d0b93c8c..5bfb631e02 100644
--- a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredJsonOutputWriter.java
+++ b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredJsonOutputWriter.java
@@ -19,8 +19,9 @@
 package org.apache.streampipes.dataexplorer.export;
 
 import org.apache.streampipes.dataexplorer.export.item.ItemGenerator;
-import org.apache.streampipes.model.datalake.param.ProvidedRestQueryParams;
 import org.apache.streampipes.dataexplorer.export.item.JsonItemGenerator;
+import org.apache.streampipes.model.datalake.DataLakeMeasure;
+import org.apache.streampipes.model.datalake.param.ProvidedRestQueryParams;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 
@@ -40,7 +41,8 @@ public class ConfiguredJsonOutputWriter extends ConfiguredOutputWriter {
   }
 
   @Override
-  public void configure(ProvidedRestQueryParams params,
+  public void configure(DataLakeMeasure schema,
+                        ProvidedRestQueryParams params,
                         boolean ignoreMissingValues) {
     // do nothing
   }
diff --git a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredOutputWriter.java b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredOutputWriter.java
index c7ff305843..2b4344a477 100644
--- a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredOutputWriter.java
+++ b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ConfiguredOutputWriter.java
@@ -18,24 +18,58 @@
 
 package org.apache.streampipes.dataexplorer.export;
 
+import org.apache.streampipes.model.datalake.DataLakeMeasure;
 import org.apache.streampipes.model.datalake.param.ProvidedRestQueryParams;
+import org.apache.streampipes.model.schema.EventProperty;
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.text.DecimalFormat;
 import java.util.List;
+import java.util.Objects;
 
 public abstract class ConfiguredOutputWriter {
 
-  public static ConfiguredOutputWriter getConfiguredWriter(OutputFormat format,
+  private final DecimalFormat df = new DecimalFormat("#");
+
+  public static ConfiguredOutputWriter getConfiguredWriter(DataLakeMeasure schema,
+                                                           OutputFormat format,
                                                            ProvidedRestQueryParams params,
                                                            boolean ignoreMissingValues) {
     var writer = format.getWriter();
-    writer.configure(params, ignoreMissingValues);
+    writer.configure(schema, params, ignoreMissingValues);
 
     return writer;
   }
 
-  public abstract void configure(ProvidedRestQueryParams params,
+  protected String getHeaderName(DataLakeMeasure schema,
+                                 String runtimeName,
+                                 String headerColumnNameStrategy) {
+    if (Objects.nonNull(schema) && headerColumnNameStrategy.equals("label")) {
+      return schema
+          .getEventSchema()
+          .getEventProperties()
+          .stream()
+          .filter(ep -> ep.getRuntimeName().equals(runtimeName))
+          .findFirst()
+          .map(ep -> extractLabel(ep, runtimeName))
+          .orElse(runtimeName);
+    } else {
+      return runtimeName;
+    }
+  }
+
+  private String extractLabel(EventProperty ep,
+                              String runtimeName) {
+    if (Objects.nonNull(ep.getLabel())) {
+      return ep.getLabel();
+    } else {
+      return runtimeName;
+    }
+  }
+
+  public abstract void configure(DataLakeMeasure schema,
+                                 ProvidedRestQueryParams params,
                                  boolean ignoreMissingValues);
 
   public abstract void beforeFirstItem(OutputStream outputStream) throws IOException;
diff --git a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ExportUtils.java b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ExportUtils.java
new file mode 100644
index 0000000000..78e77359a7
--- /dev/null
+++ b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/ExportUtils.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.streampipes.dataexplorer.export;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+
+public class ExportUtils {
+
+  private static final DecimalFormat df = new DecimalFormat("#");
+
+  public static String formatValue(Object value) {
+    if (value instanceof Double) {
+      return BigDecimal.valueOf((Double) value).toPlainString();
+    } else {
+      return String.valueOf(value);
+    }
+  }
+}
diff --git a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/OutputFormat.java b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/OutputFormat.java
index 2342f5879f..d1237afc23 100644
--- a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/OutputFormat.java
+++ b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/OutputFormat.java
@@ -18,11 +18,15 @@
 
 package org.apache.streampipes.dataexplorer.export;
 
+import org.apache.streampipes.storage.management.StorageDispatcher;
+
+import java.util.Arrays;
 import java.util.function.Supplier;
 
 public enum OutputFormat {
   JSON(ConfiguredJsonOutputWriter::new),
-  CSV(ConfiguredCsvOutputWriter::new);
+  CSV(ConfiguredCsvOutputWriter::new),
+  XLSX(() -> new ConfiguredExcelOutputWriter(StorageDispatcher.INSTANCE.getNoSqlStore().getFileMetadataStorage()));
 
   private final Supplier<ConfiguredOutputWriter> writerSupplier;
 
@@ -33,4 +37,12 @@ public enum OutputFormat {
   public ConfiguredOutputWriter getWriter() {
     return writerSupplier.get();
   }
+
+  public static OutputFormat fromString(String desiredFormat) {
+    return Arrays.stream(
+            OutputFormat.values())
+        .filter(format -> format.name().equalsIgnoreCase(desiredFormat))
+        .findFirst()
+        .orElseThrow(() -> new IllegalArgumentException(String.format("Could not find format %s", desiredFormat)));
+  }
 }
diff --git a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/item/CsvItemGenerator.java b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/item/CsvItemGenerator.java
index 4afb7ffdbd..824c05f97c 100644
--- a/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/item/CsvItemGenerator.java
+++ b/streampipes-data-explorer-export/src/main/java/org/apache/streampipes/dataexplorer/export/item/CsvItemGenerator.java
@@ -19,6 +19,8 @@
 
 package org.apache.streampipes.dataexplorer.export.item;
 
+import org.apache.streampipes.dataexplorer.export.ExportUtils;
+
 public class CsvItemGenerator extends ItemGenerator {
 
   public CsvItemGenerator(String delimiter) {
@@ -27,7 +29,7 @@ public class CsvItemGenerator extends ItemGenerator {
 
   @Override
   protected String makeItemString(String key, Object value) {
-    return value != null ? value.toString() : "";
+    return value != null ? ExportUtils.formatValue(value) : "";
   }
 
   @Override
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/StreamedQueryResultProvider.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/StreamedQueryResultProvider.java
index 18e288ec98..936fc093d4 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/StreamedQueryResultProvider.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/StreamedQueryResultProvider.java
@@ -51,15 +51,16 @@ public class StreamedQueryResultProvider extends QueryResultProvider {
 
   public void getDataAsStream(OutputStream outputStream) throws IOException {
     var usesLimit = queryParams.has(SupportedRestQueryParams.QP_LIMIT);
+    var measurement = findByMeasurementName(queryParams.getMeasurementId()).get();
+
     var configuredWriter = ConfiguredOutputWriter
-        .getConfiguredWriter(format, queryParams, ignoreMissingData);
+        .getConfiguredWriter(measurement, format, queryParams, ignoreMissingData);
 
     if (!queryParams.has(SupportedRestQueryParams.QP_LIMIT)) {
       queryParams.update(SupportedRestQueryParams.QP_LIMIT, MAX_RESULTS_PER_QUERY);
     }
 
     var limit = queryParams.getAsInt(SupportedRestQueryParams.QP_LIMIT);
-    var measurement = findByMeasurementName(queryParams.getMeasurementId()).get();
 
     SpQueryResult dataResult;
 
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/param/SupportedRestQueryParams.java b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/param/SupportedRestQueryParams.java
index 881be1c659..4ec3a83894 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/param/SupportedRestQueryParams.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/param/SupportedRestQueryParams.java
@@ -40,6 +40,10 @@ public class SupportedRestQueryParams {
   public static final String QP_AUTO_AGGREGATE = "autoAggregate";
   public static final String QP_FILTER = "filter";
   public static final String QP_MAXIMUM_AMOUNT_OF_EVENTS = "maximumAmountOfEvents";
+  public static final String QP_XLSX_USE_TEMPLATE = "useTemplate";
+  public static final String QP_XLSX_TEMPLATE_ID = "templateId";
+  public static final String QP_XLSX_START_ROW = "startRow";
+  public static final String QP_HEADER_COLUMN_NAME = "headerColumnName";
 
   public static final List<String> SUPPORTED_PARAMS = Arrays.asList(
       QP_COLUMNS,
@@ -58,7 +62,11 @@ public class SupportedRestQueryParams {
       QP_AUTO_AGGREGATE,
       QP_MISSING_VALUE_BEHAVIOUR,
       QP_FILTER,
-      QP_MAXIMUM_AMOUNT_OF_EVENTS
+      QP_MAXIMUM_AMOUNT_OF_EVENTS,
+      QP_XLSX_START_ROW,
+      QP_XLSX_TEMPLATE_ID,
+      QP_XLSX_USE_TEMPLATE,
+      QP_HEADER_COLUMN_NAME
   );
 
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/FileResource.java
similarity index 98%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/FileResource.java
index c5ff418e82..14b43b4eed 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementFile.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/FileResource.java
@@ -52,11 +52,11 @@ import static org.springframework.http.HttpStatus.NOT_FOUND;
 
 @RestController
 @RequestMapping("/api/v2/files")
-public class PipelineElementFile extends AbstractAuthGuardedRestResource {
+public class FileResource extends AbstractAuthGuardedRestResource {
 
   private final FileManager fileManager;
 
-  public PipelineElementFile() {
+  public FileResource() {
     this.fileManager = new FileManager();
   }
 
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResource.java
index acc464d960..c757a61688 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResource.java
@@ -66,6 +66,7 @@ import static org.apache.streampipes.model.datalake.param.SupportedRestQueryPara
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_FILTER;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_FORMAT;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_GROUP_BY;
+import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_HEADER_COLUMN_NAME;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_LIMIT;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_MAXIMUM_AMOUNT_OF_EVENTS;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_MISSING_VALUE_BEHAVIOUR;
@@ -74,6 +75,9 @@ import static org.apache.streampipes.model.datalake.param.SupportedRestQueryPara
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_PAGE;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_START_DATE;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_TIME_INTERVAL;
+import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_XLSX_START_ROW;
+import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_XLSX_TEMPLATE_ID;
+import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.QP_XLSX_USE_TEMPLATE;
 import static org.apache.streampipes.model.datalake.param.SupportedRestQueryParams.SUPPORTED_PARAMS;
 
 @RestController
@@ -315,6 +319,14 @@ public class DataLakeResource extends AbstractRestResource {
           description = "filter conditions (a comma-separated list of filter conditions"
               + "such as [field,operator,condition])")
       @RequestParam(value = QP_FILTER, required = false) String filter,
+      @Parameter(in = ParameterIn.QUERY, description = "Excel export with template")
+      @RequestParam(value = QP_XLSX_USE_TEMPLATE, required = false) boolean useTemplate
+      , @Parameter(in = ParameterIn.QUERY, description = "ID of the excel template file to use")
+      @RequestParam(value = QP_XLSX_TEMPLATE_ID, required = false) String templateId
+      , @Parameter(in = ParameterIn.QUERY, description = "The first row in the excel file where data should be written")
+      @RequestParam(value = QP_XLSX_START_ROW, required = false) Integer startRow,
+      @Parameter(in = ParameterIn.QUERY, description = "Use either label or key as the column header")
+      @RequestParam(value = QP_HEADER_COLUMN_NAME, required = false) String headerColumnName,
       @RequestParam Map<String, String> queryParams) {
 
 
@@ -326,7 +338,7 @@ public class DataLakeResource extends AbstractRestResource {
         format = "csv";
       }
 
-      OutputFormat outputFormat = format.equals("csv") ? OutputFormat.CSV : OutputFormat.JSON;
+      var outputFormat = OutputFormat.fromString(format);
       StreamingResponseBody streamingOutput = output -> dataExplorerQueryManagement.getDataAsStream(
           sanitizedParams,
           outputFormat,
@@ -335,7 +347,8 @@ public class DataLakeResource extends AbstractRestResource {
 
       HttpHeaders headers = new HttpHeaders();
       headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
-      headers.setContentDispositionFormData("attachment", "datalake." + outputFormat);
+      headers.setContentDispositionFormData("attachment",
+          "datalake." + outputFormat.toString().toLowerCase());
 
       return ResponseEntity.ok()
           .headers(headers)
diff --git a/ui/cypress/support/utils/DataDownloadDialogUtils.ts b/ui/cypress/support/utils/DataDownloadDialogUtils.ts
index 04ce651078..3a3b2da6ed 100644
--- a/ui/cypress/support/utils/DataDownloadDialogUtils.ts
+++ b/ui/cypress/support/utils/DataDownloadDialogUtils.ts
@@ -16,10 +16,10 @@
  *
  */
 
-import { ExportConfig } from '../../../src/app/core-ui/data-download-dialog/model/export-config.model';
+import { ExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model';
 import { DataLakeUtils } from './datalake/DataLakeUtils';
-import { FileNameService } from '../../../src/app/core-ui/data-download-dialog/services/file-name.service';
-import { CsvFormatExportConfig } from '../../../src/app/core-ui/data-download-dialog/model/format-export-config.model';
+import { FileNameService } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service';
+import { CsvFormatExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model';
 
 export class DataDownloadDialogUtils {
     public static testDownload(
@@ -55,7 +55,7 @@ export class DataDownloadDialogUtils {
 
         // Format
         cy.dataCy(
-            `download-configuration-${exportConfig.formatExportConfig.exportFormat}`,
+            `download-configuration-${exportConfig.formatExportConfig.format}`,
         ).within(() => {
             cy.get('.mdc-radio').click();
         });
diff --git a/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts b/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts
index 76f552ac3e..4b54c3e802 100644
--- a/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts
+++ b/ui/projects/streampipes/platform-services/src/lib/apis/datalake-rest.service.ts
@@ -120,18 +120,16 @@ export class DatalakeRestService {
 
     downloadRawData(
         index: string,
-        format: string,
-        delimiter: string,
+        formatConfig: Record<string, any>,
         missingValueBehaviour: string,
         startTime?: number,
         endTime?: number,
     ) {
         const queryParams =
             startTime && endTime
-                ? { format, delimiter, startDate: startTime, endDate: endTime }
+                ? { ...formatConfig, startDate: startTime, endDate: endTime }
                 : {
-                      format,
-                      delimiter,
+                      ...formatConfig,
                       missingValueBehaviour,
                   };
         return this.buildDownloadRequest(index, queryParams);
@@ -139,23 +137,20 @@ export class DatalakeRestService {
 
     downloadQueriedData(
         index: string,
-        format: string,
-        delimiter: string,
+        formatConfig: Record<string, any>,
         missingValueBehaviour: string,
         queryParams: DatalakeQueryParameters,
     ) {
-        (queryParams as any).format = format;
-        (queryParams as any).delimiter = delimiter;
-        (queryParams as any).missingValueBehaviour = missingValueBehaviour;
+        const qp = { ...formatConfig, ...queryParams, missingValueBehaviour };
 
-        return this.buildDownloadRequest(index, queryParams);
+        return this.buildDownloadRequest(index, qp);
     }
 
     buildDownloadRequest(index: string, queryParams: any) {
         const url = this.dataLakeUrl + '/measurements/' + index + '/download';
         const request = new HttpRequest('GET', url, {
             reportProgress: true,
-            responseType: 'text',
+            responseType: 'blob',
             params: this.toHttpParams(queryParams),
         });
 
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/basic-inner-panel/basic-inner-panel.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/basic-inner-panel/basic-inner-panel.component.html
index 73038461b7..7cae7a6df9 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/basic-inner-panel/basic-inner-panel.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/basic-inner-panel/basic-inner-panel.component.html
@@ -20,12 +20,11 @@
     fxLayout="column"
     fxFlex="100"
     class="panel-outer"
-    [ngStyle]="{ margin: outerMargin }"
+    [ngStyle]="{ margin: outerMargin, height: '100%' }"
 >
     <div
         class="general-panel-header"
         fxLayout="row"
-        fxFlex="100"
         fxLayoutAlign="start center"
         *ngIf="!hideToolbar"
     >
@@ -35,11 +34,14 @@
                     {{ panelTitle }}
                 </div>
             </div>
-            <ng-content select="[header]" fxFlex class="pr-5"></ng-content>
+            <ng-content select="[header]" class="pr-5"></ng-content>
         </div>
     </div>
 
-    <div class="general-panel" [ngStyle]="{ padding: innerPadding }">
+    <div
+        class="general-panel"
+        [ngStyle]="{ padding: innerPadding, height: '100%' }"
+    >
         <ng-content fxFlex="100"></ng-content>
     </div>
 </div>
diff --git a/ui/src/app/core-ui/configuration-box/configuration-box.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.html
similarity index 100%
rename from ui/src/app/core-ui/configuration-box/configuration-box.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.html
diff --git a/ui/src/app/core-ui/configuration-box/configuration-box.component.scss b/ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.scss
similarity index 100%
rename from ui/src/app/core-ui/configuration-box/configuration-box.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.scss
diff --git a/ui/src/app/core-ui/configuration-box/configuration-box.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.ts
similarity index 100%
rename from ui/src/app/core-ui/configuration-box/configuration-box.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.ts
diff --git a/ui/src/app/core-ui/date-input/date-input.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.html
similarity index 100%
rename from ui/src/app/core-ui/date-input/date-input.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.html
diff --git a/ui/src/app/core-ui/date-input/date-input.component.scss b/ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.scss
similarity index 100%
rename from ui/src/app/core-ui/date-input/date-input.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.scss
diff --git a/ui/src/app/core-ui/date-input/date-input.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.ts
similarity index 99%
rename from ui/src/app/core-ui/date-input/date-input.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.ts
index 9409b0a4ff..b269dfa567 100644
--- a/ui/src/app/core-ui/date-input/date-input.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.ts
@@ -35,7 +35,7 @@ export class DateInputComponent {
     dateChanged = new EventEmitter<void>();
 
     get formattedDate(): string {
-        return this.date ? format(this.date, "yyyy-MM-dd'T'HH:mm") : '';
+        return this.date ? format(this.date, "yyyy-MM-dd'T'HH:mm:ss") : '';
     }
 
     onDateChange(value: string): void {
diff --git a/ui/src/app/core-ui/data-download-dialog/components/download/download.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.html
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/download/download.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.html
diff --git a/ui/src/app/core-ui/data-download-dialog/components/download/download.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/download/download.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/components/download/download.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/download/download.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
similarity index 56%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
index a22dad4c62..c507310bd5 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
@@ -16,23 +16,24 @@
   ~
   -->
 
-<h5>Behaviour in case of missing values</h5>
-<mat-radio-group
-    class="sp-radio-group"
-    [(ngModel)]="dataExportConfig.missingValueBehaviour"
->
-    <mat-radio-button
-        value="ignore"
-        class="sp-radio-button"
-        data-cy="download-configuration-ignore"
+<sp-configuration-box title="Behaviour in case of missing values">
+    <mat-radio-group
+        class="sp-radio-group"
+        [(ngModel)]="dataExportConfig.missingValueBehaviour"
     >
-        Ignore lines with missing value
-    </mat-radio-button>
-    <mat-radio-button
-        value="empty"
-        class="sp-radio-button"
-        data-cy="download-configuration-empty"
-    >
-        Leave entry empty
-    </mat-radio-button>
-</mat-radio-group>
+        <mat-radio-button
+            value="ignore"
+            class="sp-radio-button"
+            data-cy="download-configuration-ignore"
+        >
+            Ignore lines with missing value
+        </mat-radio-button>
+        <mat-radio-button
+            value="empty"
+            class="sp-radio-button"
+            data-cy="download-configuration-empty"
+        >
+            Leave entry empty
+        </mat-radio-button>
+    </mat-radio-group>
+</sp-configuration-box>
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
similarity index 51%
rename from ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
index 77a4f7445b..eeef53fca5 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
@@ -16,46 +16,50 @@
   ~
   -->
 
-<ng-template matStepLabel>Select Format</ng-template>
-<div>
-    <h5>Download Format</h5>
+<sp-configuration-box title="Data Range">
     <mat-radio-group
         class="sp-radio-group"
-        [(ngModel)]="formatExportConfig.exportFormat"
+        [(ngModel)]="dataExportConfig.dataRangeConfiguration"
     >
         <mat-radio-button
-            value="json"
+            value="visible"
             class="sp-radio-button"
-            data-cy="download-configuration-json"
+            data-cy="download-configuration-visible"
+            *ngIf="dataExplorerDataConfig"
         >
-            JSON
+            Currently configured query
         </mat-radio-button>
         <mat-radio-button
-            value="csv"
+            value="all"
             class="sp-radio-button"
-            data-cy="download-configuration-csv"
+            data-cy="download-configuration-all"
         >
-            CSV
+            All data in database
         </mat-radio-button>
-    </mat-radio-group>
-</div>
-<div *ngIf="formatExportConfig.exportFormat === 'csv'" class="mt-10">
-    <h5>Delimiter</h5>
-    <mat-radio-group
-        [(ngModel)]="formatExportConfig.delimiter"
-        class="sp-radio-group"
-    >
         <mat-radio-button
-            value="comma"
+            value="customInterval"
             class="sp-radio-button"
-            data-cy="download-configuration-delimiter-comma"
-            >&nbsp;,</mat-radio-button
+            data-cy="download-configuration-customInterval"
         >
-        <mat-radio-button
-            value="semicolon"
-            class="sp-radio-button"
-            data-cy="download-configuration-delimiter-semicolon"
-            >&nbsp;;</mat-radio-button
+            All data in custom time interval
+        </mat-radio-button>
+
+        <div
+            fxLayout="row"
+            fxLayoutGap="10px"
+            class="ml-35"
+            *ngIf="dataExportConfig.dataRangeConfiguration === 'customInterval'"
         >
+            <div>
+                <h5>From&nbsp;</h5>
+                <sp-date-input [(date)]="dataExportConfig.dateRange.startDate">
+                </sp-date-input>
+            </div>
+            <div>
+                <h5>To&nbsp;</h5>
+                <sp-date-input [(date)]="dataExportConfig.dateRange.endDate">
+                </sp-date-input>
+            </div>
+        </div>
     </mat-radio-group>
-</div>
+</sp-configuration-box>
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.html
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.html
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.scss
similarity index 94%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.scss
index fe9dc8d86b..8c8e47d1e6 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.scss
@@ -16,7 +16,7 @@
  *
  */
 
-@import '../../../../../scss/sp/sp-dialog';
+@import '../../../../../../../../../src/scss/sp/sp-dialog';
 
 .sp-radio-group {
     display: flex;
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.ts
index 9bc10c72c4..9e7dbc4267 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.ts
@@ -18,8 +18,8 @@
 
 import { Component, Input } from '@angular/core';
 
-import { DataExplorerDataConfig } from '@streampipes/platform-services';
 import { DataExportConfig } from '../../model/data-export-config.model';
+import { DataExplorerDataConfig } from '@streampipes/platform-services';
 
 @Component({
     selector: 'sp-select-data',
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.html
new file mode 100644
index 0000000000..ba5fe2b074
--- /dev/null
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.html
@@ -0,0 +1,134 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one or more
+  ~  contributor license agreements.  See the NOTICE file distributed with
+  ~  this work for additional information regarding copyright ownership.
+  ~  The ASF licenses this file to You under the Apache License, Version 2.0
+  ~  (the "License"); you may not use this file except in compliance with
+  ~  the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+
+<ng-template matStepLabel>Select Format</ng-template>
+<div>
+    <sp-configuration-box title="Download Format">
+        <mat-radio-group
+            class="sp-radio-group"
+            [(ngModel)]="formatExportConfig.format"
+        >
+            <mat-radio-button
+                value="json"
+                class="sp-radio-button"
+                data-cy="download-configuration-json"
+            >
+                JSON
+            </mat-radio-button>
+            <mat-radio-button
+                value="csv"
+                class="sp-radio-button"
+                data-cy="download-configuration-csv"
+            >
+                CSV
+            </mat-radio-button>
+            <mat-radio-button
+                value="xlsx"
+                class="sp-radio-button"
+                data-cy="download-configuration-xlsx"
+            >
+                Excel (XLSX)
+            </mat-radio-button>
+        </mat-radio-group>
+    </sp-configuration-box>
+</div>
+<div *ngIf="formatExportConfig.format === 'csv'" class="mt-10">
+    <sp-configuration-box title="Delimiter">
+        <mat-radio-group
+            [(ngModel)]="formatExportConfig.delimiter"
+            class="sp-radio-group"
+        >
+            <mat-radio-button
+                value="comma"
+                class="sp-radio-button"
+                data-cy="download-configuration-delimiter-comma"
+                >&nbsp;,
+            </mat-radio-button>
+            <mat-radio-button
+                value="semicolon"
+                class="sp-radio-button"
+                data-cy="download-configuration-delimiter-semicolon"
+                >&nbsp;;
+            </mat-radio-button>
+        </mat-radio-group>
+    </sp-configuration-box>
+</div>
+<div
+    *ngIf="formatExportConfig.format === 'xlsx' && hasReadFilePrivilege"
+    fxLayout="column"
+>
+    <sp-configuration-box title="Excel template">
+        <div fxLayout="column">
+            <mat-checkbox
+                [(ngModel)]="formatExportConfig.useTemplate"
+                [disabled]="excelTemplates.length === 0"
+            >
+                Use uploaded file template
+            </mat-checkbox>
+            @if (formatExportConfig.useTemplate && excelTemplates.length > 0) {
+                <mat-form-field class="mt-10" color="accent">
+                    <mat-select
+                        [(ngModel)]="formatExportConfig.templateId"
+                        placeholder="Choose template"
+                    >
+                        <mat-option
+                            *ngFor="let template of excelTemplates"
+                            [value]="template.fileId"
+                        >
+                            {{ template.filename }}
+                        </mat-option>
+                    </mat-select>
+                </mat-form-field>
+                <mat-form-field color="accent">
+                    <mat-label>First row index to append data</mat-label>
+                    <input
+                        matInput
+                        [(ngModel)]="formatExportConfig.startRow"
+                        type="number"
+                    />
+                </mat-form-field>
+            }
+        </div>
+    </sp-configuration-box>
+</div>
+<div
+    *ngIf="
+        formatExportConfig.format === 'xlsx' ||
+        formatExportConfig.format === 'csv'
+    "
+>
+    <sp-configuration-box title="Header column name">
+        <mat-radio-group
+            [(ngModel)]="formatExportConfig.headerColumnName"
+            class="sp-radio-group"
+        >
+            <mat-radio-button
+                value="key"
+                class="sp-radio-button"
+                data-cy="download-configuration-column-name-key"
+                >Use field key (runtime name) as header column
+            </mat-radio-button>
+            <mat-radio-button
+                value="label"
+                class="sp-radio-button"
+                data-cy="download-configuration-column-name-label"
+                >Use field label as header column if available
+            </mat-radio-button>
+        </mat-radio-group>
+    </sp-configuration-box>
+</div>
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.ts
similarity index 58%
rename from ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.ts
index d69b5e267c..65c67e535c 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.ts
@@ -16,8 +16,10 @@
  *
  */
 
-import { Component, Input } from '@angular/core';
+import { Component, inject, Input, OnInit } from '@angular/core';
 import { FormatExportConfig } from '../../model/format-export-config.model';
+import { FileMetadata, FilesService } from '@streampipes/platform-services';
+import { CurrentUserService } from '../../../../services/current-user.service';
 
 @Component({
     selector: 'sp-select-format',
@@ -27,8 +29,27 @@ import { FormatExportConfig } from '../../model/format-export-config.model';
         '../../data-download-dialog.component.scss',
     ],
 })
-export class SelectFormatComponent {
+export class SelectFormatComponent implements OnInit {
     @Input() formatExportConfig: FormatExportConfig;
 
+    hasReadFilePrivilege = false;
+    excelTemplates: FileMetadata[] = [];
+
+    private fileService = inject(FilesService);
+    private currentUserService = inject(CurrentUserService);
+
     constructor() {}
+
+    ngOnInit() {
+        this.hasReadFilePrivilege = this.currentUserService.hasRole(
+            'PRIVILEGE_READ_FILES',
+        );
+        if (this.hasReadFilePrivilege) {
+            this.fileService
+                .getFileMetadata(['xlsx'])
+                .subscribe(excelTemplates => {
+                    this.excelTemplates = excelTemplates;
+                });
+        }
+    }
 }
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.html
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.html
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.scss
similarity index 96%
rename from ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.scss
index 90c5a378b6..c37920a318 100644
--- a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.scss
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.scss
@@ -16,7 +16,7 @@
  *
  */
 
-@import '../../../scss/sp/sp-dialog';
+@import '../../../../../../../src/scss/sp/sp-dialog';
 
 .sp-radio-group {
     display: flex;
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
similarity index 93%
rename from ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
index 4a0b6a199b..b2bbde88e7 100644
--- a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
@@ -18,7 +18,7 @@
 
 import { Component, Input, OnInit, ViewChild } from '@angular/core';
 import { MatStepper } from '@angular/material/stepper';
-import { DialogRef } from '@streampipes/shared-ui';
+import { DialogRef } from '../base-dialog/dialog-ref';
 import { ExportConfig } from './model/export-config.model';
 import { DataDownloadDialogModel } from './model/data-download-dialog.model';
 import { DataExportService } from './services/data-export.service';
@@ -34,6 +34,7 @@ export class DataDownloadDialogComponent implements OnInit {
     @ViewChild('downloadDialogStepper', { static: true })
     downloadDialogStepper: MatStepper;
 
+    @Input()
     exportConfig: ExportConfig;
 
     constructor(
@@ -48,17 +49,19 @@ export class DataDownloadDialogComponent implements OnInit {
                 : this.dataDownloadDialogModel.dataExplorerDataConfig
                       .sourceConfigs[0].measureName;
 
-        this.exportConfig = {
+        this.exportConfig ??= {
             dataExportConfig: {
                 dataRangeConfiguration: 'all',
                 missingValueBehaviour: 'ignore',
                 measurement: measurementName,
             },
             formatExportConfig: {
-                exportFormat: 'csv',
+                format: 'csv',
                 delimiter: 'comma',
+                headerColumnName: 'key',
             },
         };
+        console.log(this.exportConfig);
     }
 
     exitDialog() {
diff --git a/ui/src/app/core-ui/data-download-dialog/model/data-download-dialog.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-download-dialog.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/data-download-dialog.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-download-dialog.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-export-config.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-export-config.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/download-progress.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/download-progress.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/download-progress.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/download-progress.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model.ts
similarity index 82%
rename from ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model.ts
index 6562bfb909..fab91f13c0 100644
--- a/ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model.ts
@@ -34,13 +34,25 @@
  *
  */
 
-export type FormatExportConfig = JsonFormatExportConfig | CsvFormatExportConfig;
+export type FormatExportConfig =
+    | JsonFormatExportConfig
+    | CsvFormatExportConfig
+    | ExcelFormatConfig;
 
 export interface JsonFormatExportConfig {
-    exportFormat: 'json';
+    format: 'json';
 }
 
 export interface CsvFormatExportConfig {
-    exportFormat: 'csv';
+    format: 'csv';
     delimiter: 'comma' | 'semicolon';
+    headerColumnName: 'key' | 'label';
+}
+
+export interface ExcelFormatConfig {
+    format: 'xlsx';
+    templateId: string;
+    startRow: number;
+    useTemplate: boolean;
+    headerColumnName: 'key' | 'label';
 }
diff --git a/ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
similarity index 92%
rename from ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
index 4725487714..a014ed97f9 100644
--- a/ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
@@ -52,8 +52,7 @@ export class DataExportService {
         ) {
             downloadRequest = this.dataLakeRestService.downloadQueriedData(
                 exportConfig.dataExportConfig.measurement,
-                exportConfig.formatExportConfig.exportFormat,
-                exportConfig.formatExportConfig['delimiter'],
+                exportConfig.formatExportConfig,
                 exportConfig.dataExportConfig.missingValueBehaviour,
                 this.generateQueryRequest(
                     exportConfig,
@@ -75,8 +74,7 @@ export class DataExportService {
             }
             downloadRequest = this.dataLakeRestService.downloadRawData(
                 exportConfig.dataExportConfig.measurement,
-                exportConfig.formatExportConfig.exportFormat,
-                exportConfig.formatExportConfig['delimiter'],
+                exportConfig.formatExportConfig,
                 exportConfig.dataExportConfig.missingValueBehaviour,
                 startTime,
                 endTime,
@@ -139,12 +137,9 @@ export class DataExportService {
             exportConfig,
             new Date(),
         );
+        const blob = new Blob([data]);
 
-        const url = window.URL.createObjectURL(
-            new Blob([String(data)], {
-                type: `data:text/${exportConfig.formatExportConfig.exportFormat};charset=utf-8`,
-            }),
-        );
+        const url = window.URL.createObjectURL(blob);
         a.href = url;
         a.download = name;
         a.click();
diff --git a/ui/src/app/core-ui/data-download-dialog/services/file-name.service.spec.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.spec.ts
similarity index 95%
rename from ui/src/app/core-ui/data-download-dialog/services/file-name.service.spec.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.spec.ts
index 74430dc99e..deef6c48ed 100644
--- a/ui/src/app/core-ui/data-download-dialog/services/file-name.service.spec.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.spec.ts
@@ -40,7 +40,7 @@ describe('FileNameService', () => {
                 measurement: 'measurement',
             },
             formatExportConfig: {
-                exportFormat: 'csv',
+                format: 'csv',
                 delimiter: 'comma',
             },
         };
@@ -55,7 +55,7 @@ describe('FileNameService', () => {
     });
 
     it('Name for all data json', () => {
-        defaultExportConfig.formatExportConfig.exportFormat = 'json';
+        defaultExportConfig.formatExportConfig.format = 'json';
         const result = service.generateName(
             defaultExportConfig,
             defaultExportDate,
@@ -78,7 +78,7 @@ describe('FileNameService', () => {
     });
 
     it('Name for custom visible json', () => {
-        defaultExportConfig.formatExportConfig.exportFormat = 'json';
+        defaultExportConfig.formatExportConfig.format = 'json';
         defaultExportConfig.dataExportConfig.dataRangeConfiguration = 'visible';
         defaultExportConfig.dataExportConfig.dateRange = defaultDateRange;
 
diff --git a/ui/src/app/core-ui/data-download-dialog/services/file-name.service.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.ts
similarity index 99%
rename from ui/src/app/core-ui/data-download-dialog/services/file-name.service.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.ts
index 878bd50355..66d8fe5b60 100644
--- a/ui/src/app/core-ui/data-download-dialog/services/file-name.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.ts
@@ -30,7 +30,7 @@ export class FileNameService {
         const dataRangeOption =
             exportConfig.dataExportConfig.dataRangeConfiguration;
         let dateRange = '';
-        const fileExtension = `.${exportConfig.formatExportConfig.exportFormat}`;
+        const fileExtension = `.${exportConfig.formatExportConfig.format}`;
 
         if (
             exportConfig.dataExportConfig.dateRange !== undefined &&
diff --git a/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts b/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts
index ee9a72ba55..131f813f35 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts
@@ -70,6 +70,18 @@ import { MatFormFieldModule } from '@angular/material/form-field';
 import { MatMenuModule } from '@angular/material/menu';
 import { FormsModule } from '@angular/forms';
 import { MatTreeModule } from '@angular/material/tree';
+import { DataDownloadDialogComponent } from './dialog/data-download-dialog/data-download-dialog.component';
+import { MatStepperModule } from '@angular/material/stepper';
+import { SelectDataComponent } from './dialog/data-download-dialog/components/select-data/select-data.component';
+import { SelectFormatComponent } from './dialog/data-download-dialog/components/select-format/select-format.component';
+import { DownloadComponent } from './dialog/data-download-dialog/components/download/download.component';
+import { SelectDataRangeComponent } from './dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component';
+import { SelectDataMissingValuesComponent } from './dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component';
+import { MatRadioModule } from '@angular/material/radio';
+import { SpConfigurationBoxComponent } from './components/configuration-box/configuration-box.component';
+import { DateInputComponent } from './components/date-input/date-input.component';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatInputModule } from '@angular/material/input';
 
 @NgModule({
     declarations: [
@@ -85,6 +97,8 @@ import { MatTreeModule } from '@angular/material/tree';
         AssetBrowserToolbarComponent,
         ConfirmDialogComponent,
         CustomTimeRangeSelectionComponent,
+        DataDownloadDialogComponent,
+        DateInputComponent,
         PanelDialogComponent,
         StandardDialogComponent,
         SpBasicFieldDescriptionComponent,
@@ -102,15 +116,23 @@ import { MatTreeModule } from '@angular/material/tree';
         TimeRangeSelectorComponent,
         TimeRangeSelectorMenuComponent,
         DataExplorerRefreshIntervalSettingsComponent,
+        SelectDataComponent,
+        SelectFormatComponent,
+        DownloadComponent,
+        SpConfigurationBoxComponent,
+        SelectDataRangeComponent,
+        SelectDataMissingValuesComponent,
     ],
     imports: [
         CommonModule,
         FlexLayoutModule,
         FormsModule,
         MatButtonModule,
+        MatCheckboxModule,
         MatDividerModule,
         MatFormFieldModule,
         MatIconModule,
+        MatInputModule,
         MatMenuModule,
         MatSelectModule,
         MatTabsModule,
@@ -121,14 +143,18 @@ import { MatTreeModule } from '@angular/material/tree';
         PortalModule,
         OverlayModule,
         MatDialogModule,
+        MatStepperModule,
         MatTableModule,
         MatPaginator,
+        MatRadioModule,
         MatSort,
     ],
     providers: [DefaultMatCalendarRangeStrategy, MatRangeDateSelectionModel],
     exports: [
         AssetBrowserComponent,
         ConfirmDialogComponent,
+        DataDownloadDialogComponent,
+        DateInputComponent,
         PanelDialogComponent,
         StandardDialogComponent,
         SpBasicFieldDescriptionComponent,
@@ -136,6 +162,7 @@ import { MatTreeModule } from '@angular/material/tree';
         SpBasicHeaderTitleComponent,
         SpBasicViewComponent,
         SpBasicNavTabsComponent,
+        SpConfigurationBoxComponent,
         SpExceptionDetailsComponent,
         SpExceptionMessageComponent,
         SpExceptionDetailsDialogComponent,
diff --git a/ui/projects/streampipes/shared-ui/src/public-api.ts b/ui/projects/streampipes/shared-ui/src/public-api.ts
index fc63ee4a92..cbf05ab894 100644
--- a/ui/projects/streampipes/shared-ui/src/public-api.ts
+++ b/ui/projects/streampipes/shared-ui/src/public-api.ts
@@ -21,6 +21,7 @@ export * from './lib/shared-ui.module';
 export * from './lib/dialog/base-dialog/base-dialog.model';
 export * from './lib/dialog/base-dialog/base-dialog.service';
 export * from './lib/dialog/base-dialog/dialog-ref';
+export * from './lib/dialog/data-download-dialog/data-download-dialog.component';
 
 export * from './lib/dialog/confirm-dialog/confirm-dialog.component';
 export * from './lib/dialog/panel-dialog/panel-dialog.component';
@@ -32,6 +33,8 @@ export * from './lib/components/basic-inner-panel/basic-inner-panel.component';
 export * from './lib/components/basic-field-description/basic-field-description.component';
 export * from './lib/components/basic-view/basic-view.component';
 export * from './lib/components/basic-nav-tabs/basic-nav-tabs.component';
+export * from './lib/components/configuration-box/configuration-box.component';
+export * from './lib/components/date-input/date-input.component';
 export * from './lib/components/split-section/split-section.component';
 export * from './lib/components/sp-exception-message/sp-exception-message.component';
 export * from './lib/components/sp-exception-message/exception-details-dialog/exception-details-dialog.component';
diff --git a/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts b/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
index 41d21bd933..93b7c72e55 100644
--- a/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
+++ b/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
@@ -26,6 +26,7 @@ import {
 import { MatPaginator } from '@angular/material/paginator';
 import { MatSort } from '@angular/material/sort';
 import {
+    DataDownloadDialogComponent,
     DialogRef,
     DialogService,
     PanelType,
@@ -35,7 +36,6 @@ import {
 import { DeleteDatalakeIndexComponent } from '../dialog/delete-datalake-index/delete-datalake-index-dialog.component';
 import { SpConfigurationTabsService } from '../configuration-tabs.service';
 import { SpConfigurationRoutes } from '../configuration.routes';
-import { DataDownloadDialogComponent } from '../../core-ui/data-download-dialog/data-download-dialog.component';
 
 @Component({
     selector: 'sp-datalake-configuration',
diff --git a/ui/src/app/core-ui/core-ui.module.ts b/ui/src/app/core-ui/core-ui.module.ts
index bae8bdd7b2..586e207a66 100644
--- a/ui/src/app/core-ui/core-ui.module.ts
+++ b/ui/src/app/core-ui/core-ui.module.ts
@@ -65,16 +65,9 @@ import { PlatformServicesModule } from '@streampipes/platform-services';
 import { SharedUiModule } from '@streampipes/shared-ui';
 import { PipelineElementTemplateConfigComponent } from './pipeline-element-template-config/pipeline-element-template-config.component';
 import { PipelineElementTemplatePipe } from './pipeline-element-template-config/pipeline-element-template.pipe';
-import { DataDownloadDialogComponent } from './data-download-dialog/data-download-dialog.component';
-import { SelectDataComponent } from './data-download-dialog/components/select-data/select-data.component';
-import { SelectFormatComponent } from './data-download-dialog/components/select-format/select-format.component';
-import { DownloadComponent } from './data-download-dialog/components/download/download.component';
-import { SelectDataRangeComponent } from './data-download-dialog/components/select-data/select-data-range/select-data-range.component';
-import { SelectDataMissingValuesComponent } from './data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component';
 import { StatusWidgetComponent } from './status/status-widget.component';
 import { SpSimpleMetricsComponent } from './monitoring/simple-metrics/simple-metrics.component';
 import { SpSimpleLogsComponent } from './monitoring/simple-logs/simple-logs.component';
-import { DateInputComponent } from './date-input/date-input.component';
 import { HelpComponent } from './help/help.component';
 import { PipelineElementRuntimeInfoComponent } from './pipeline-element-runtime-info/pipeline-element-runtime-info.component';
 import { PipelineElementDocumentationComponent } from './pipeline-element-documentation/pipeline-element-documentation.component';
@@ -121,7 +114,6 @@ import { ConfigurationCodePanelComponent } from './configuration-code-panel/conf
 import { JsonPrettyPrintPipe } from './pipes/json-pretty-print.pipe';
 import { YamlPrettyPrintPipe } from './pipes/yaml-pretty-print.pipe';
 import { TopicsComponent } from './topics/topics.component';
-import { SpConfigurationBoxComponent } from './configuration-box/configuration-box.component';
 
 @NgModule({
     imports: [
@@ -176,8 +168,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
     ],
     declarations: [
         ConfigurationCodePanelComponent,
-        DataDownloadDialogComponent,
-        DateInputComponent,
         DisplayRecommendedPipe,
         ObjectPermissionDialogComponent,
         PipelineElementTemplateConfigComponent,
@@ -214,12 +204,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
         ErrorHintComponent,
         AddToCollectionComponent,
         PipelineStartedStatusComponent,
-        SelectDataComponent,
-        SelectFormatComponent,
-        DownloadComponent,
-        SelectDataRangeComponent,
-        SelectDataMissingValuesComponent,
-        SpConfigurationBoxComponent,
         SpSimpleLogsComponent,
         SpSimpleMetricsComponent,
         StatusWidgetComponent,
@@ -236,8 +220,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
     providers: [MatDatepickerModule, DisplayRecommendedPipe],
     exports: [
         ConfigurationCodePanelComponent,
-        DataDownloadDialogComponent,
-        DateInputComponent,
         PipelineElementTemplateConfigComponent,
         PipelineElementRuntimeInfoComponent,
         PipelineElementDocumentationComponent,
@@ -261,7 +243,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
         StaticSlideToggleComponent,
         ErrorHintComponent,
         PipelineStartedStatusComponent,
-        SpConfigurationBoxComponent,
         SpSimpleLogsComponent,
         SpSimpleMetricsComponent,
         StatusWidgetComponent,
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
deleted file mode 100644
index cef9f3d334..0000000000
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one or more
-  ~  contributor license agreements.  See the NOTICE file distributed with
-  ~  this work for additional information regarding copyright ownership.
-  ~  The ASF licenses this file to You under the Apache License, Version 2.0
-  ~  (the "License"); you may not use this file except in compliance with
-  ~  the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-
-<h5>Data Range</h5>
-<mat-radio-group
-    class="sp-radio-group"
-    [(ngModel)]="dataExportConfig.dataRangeConfiguration"
->
-    <mat-radio-button
-        value="visible"
-        class="sp-radio-button"
-        data-cy="download-configuration-visible"
-        *ngIf="dataExplorerDataConfig"
-    >
-        Currently configured query
-    </mat-radio-button>
-    <mat-radio-button
-        value="all"
-        class="sp-radio-button"
-        data-cy="download-configuration-all"
-    >
-        All data in database
-    </mat-radio-button>
-    <mat-radio-button
-        value="customInterval"
-        class="sp-radio-button"
-        data-cy="download-configuration-customInterval"
-    >
-        All data in custom time interval
-    </mat-radio-button>
-
-    <div
-        fxLayout="row"
-        fxLayoutGap="10px"
-        class="ml-35"
-        *ngIf="dataExportConfig.dataRangeConfiguration === 'customInterval'"
-    >
-        <div>
-            <h5>From&nbsp;</h5>
-            <sp-date-input [(date)]="dataExportConfig.dateRange.startDate">
-            </sp-date-input>
-        </div>
-        <div>
-            <h5>To&nbsp;</h5>
-            <sp-date-input [(date)]="dataExportConfig.dateRange.endDate">
-            </sp-date-input>
-        </div>
-    </div>
-</mat-radio-group>
diff --git a/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts b/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts
index 02eb54ff2a..ad85f31bf9 100644
--- a/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts
+++ b/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts
@@ -23,8 +23,11 @@ import {
     DateRange,
     TimeSettings,
 } from '@streampipes/platform-services';
-import { DialogService, PanelType } from '@streampipes/shared-ui';
-import { DataDownloadDialogComponent } from '../../core-ui/data-download-dialog/data-download-dialog.component';
+import {
+    DataDownloadDialogComponent,
+    DialogService,
+    PanelType,
+} from '@streampipes/shared-ui';
 import { ObjectPermissionDialogComponent } from '../../core-ui/object-permission-dialog/object-permission-dialog.component';
 
 @Injectable({ providedIn: 'root' })


Test patch:
diff --git a/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredCsvOutputWriter.java b/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredCsvOutputWriter.java
index 0fc7cec228..15a6b66e28 100644
--- a/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredCsvOutputWriter.java
+++ b/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredCsvOutputWriter.java
@@ -36,7 +36,7 @@ public class TestConfiguredCsvOutputWriter extends TestConfiguredOutputWriter {
   @Test
   public void testCsvOutputWriter() throws IOException {
     var writer = new ConfiguredCsvOutputWriter();
-    writer.configure(new ProvidedRestQueryParams(null, new HashMap<>()), true);
+    writer.configure(null, new ProvidedRestQueryParams(null, new HashMap<>()), true);
 
     try (var outputStream = new ByteArrayOutputStream()) {
       writer.beforeFirstItem(outputStream);
diff --git a/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredJsonOutputWriter.java b/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredJsonOutputWriter.java
index b67b65ea28..3d5dc795d1 100644
--- a/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredJsonOutputWriter.java
+++ b/streampipes-data-explorer-export/src/test/java/org/apache/streampipes/dataexplorer/export/TestConfiguredJsonOutputWriter.java
@@ -37,7 +37,7 @@ public class TestConfiguredJsonOutputWriter extends TestConfiguredOutputWriter {
   @Test
   public void testJsonOutputWriter() throws IOException {
     var writer = new ConfiguredJsonOutputWriter();
-    writer.configure(new ProvidedRestQueryParams(null, new HashMap<>()), true);
+    writer.configure(null, new ProvidedRestQueryParams(null, new HashMap<>()), true);
 
     try (var outputStream = new ByteArrayOutputStream()) {
       writer.beforeFirstItem(outputStream);
diff --git a/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts b/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts
index 29f7b79e74..19646718da 100644
--- a/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts
+++ b/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts
@@ -16,7 +16,7 @@
  *
  */
 
-import { ExportConfig } from '../../../src/app/core-ui/data-download-dialog/model/export-config.model';
+import { ExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model';
 import { DataDownloadDialogUtils } from '../../support/utils/DataDownloadDialogUtils';
 import { DataLakeUtils } from '../../support/utils/datalake/DataLakeUtils';
 import { PrepareTestDataUtils } from '../../support/utils/PrepareTestDataUtils';
@@ -51,8 +51,9 @@ describe('Test data explorer data download dialog', () => {
 
     it('Test csv export with semicolon', () => {
         formatTestsExportConfig.formatExportConfig = {
-            exportFormat: 'csv',
+            format: 'csv',
             delimiter: 'semicolon',
+            headerColumnName: 'key',
         };
         const resultFile = 'testCsvSemicolon.csv';
 
@@ -65,8 +66,9 @@ describe('Test data explorer data download dialog', () => {
 
     it('Test csv export with comma', () => {
         formatTestsExportConfig.formatExportConfig = {
-            exportFormat: 'csv',
+            format: 'csv',
             delimiter: 'comma',
+            headerColumnName: 'key',
         };
         const resultFile = 'testCsvComma.csv';
 
@@ -79,7 +81,7 @@ describe('Test data explorer data download dialog', () => {
 
     it('Test json export', () => {
         formatTestsExportConfig.formatExportConfig = {
-            exportFormat: 'json',
+            format: 'json',
         };
 
         const resultFile = 'testJson.json';
@@ -92,8 +94,9 @@ describe('Test data explorer data download dialog', () => {
 
     it('Test csv export with semicolon and remove missing values', () => {
         formatTestsExportConfig.formatExportConfig = {
-            exportFormat: 'csv',
+            format: 'csv',
             delimiter: 'semicolon',
+            headerColumnName: 'key',
         };
         formatTestsExportConfig.dataExportConfig.missingValueBehaviour =
             'ignore';
diff --git a/ui/cypress/tests/experimental/testJvmArchetype/.env b/ui/cypress/tests/experimental/testJvmArchetype/.env
index 0ad93efe88..64d59da58b 100644
--- a/ui/cypress/tests/experimental/testJvmArchetype/.env
+++ b/ui/cypress/tests/experimental/testJvmArchetype/.env
@@ -15,5 +15,4 @@
 
 SP_VERSION=0.70.0
 SP_DOCKER_REGISTRY=apachestreampipes
-SP_SUBNET=172.31.0.0/16
 COMPOSE_PROJECT_NAME=streampipes
diff --git a/ui/cypress/tests/experimental/testJvmArchetype/backend/.env b/ui/cypress/tests/experimental/testJvmArchetype/backend/.env
index 0ad93efe88..64d59da58b 100644
--- a/ui/cypress/tests/experimental/testJvmArchetype/backend/.env
+++ b/ui/cypress/tests/experimental/testJvmArchetype/backend/.env
@@ -15,5 +15,4 @@
 
 SP_VERSION=0.70.0
 SP_DOCKER_REGISTRY=apachestreampipes
-SP_SUBNET=172.31.0.0/16
 COMPOSE_PROJECT_NAME=streampipes
diff --git a/ui/cypress/tests/experimental/testJvmArchetype/backend/docker-compose.yml b/ui/cypress/tests/experimental/testJvmArchetype/backend/docker-compose.yml
index debed8f18b..21d03be14d 100644
--- a/ui/cypress/tests/experimental/testJvmArchetype/backend/docker-compose.yml
+++ b/ui/cypress/tests/experimental/testJvmArchetype/backend/docker-compose.yml
@@ -40,6 +40,3 @@ volumes:
 networks:
     spnet:
         driver: bridge
-        ipam:
-            config:
-                - subnet: ${SP_SUBNET}
diff --git a/ui/cypress/tests/experimental/testJvmArchetype/docker-compose.yml b/ui/cypress/tests/experimental/testJvmArchetype/docker-compose.yml
index 41ea68cc57..5853f3c5d1 100644
--- a/ui/cypress/tests/experimental/testJvmArchetype/docker-compose.yml
+++ b/ui/cypress/tests/experimental/testJvmArchetype/docker-compose.yml
@@ -126,6 +126,3 @@ volumes:
 networks:
     spnet:
         driver: bridge
-        ipam:
-            config:
-                - subnet: ${SP_SUBNET}