# How to access the samplesheet in the seqera Pre-run script

**URL:** https://community.seqera.io/t/how-to-access-the-samplesheet-in-the-seqera-pre-run-script/1281
**Category:** Ask for help
**Created:** [October 11, 2024, 2:16pm UTC](https://community.seqera.io/t/how-to-access-the-samplesheet-in-the-seqera-pre-run-script/1281 "2024-10-11T14:16:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ramirobarrantes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ramirobarrantes/32/717_2.png) [@ramirobarrantes](https://community.seqera.io/u/ramirobarrantes)
#### Post date: [October 11, 2024, 2:16pm UTC](https://community.seqera.io/t/how-to-access-the-samplesheet-in-the-seqera-pre-run-script/1281/1 "2024-10-11T14:16:16Z")

</div>

I am doing my first seqera platform pipeline. I need to execute a script before the pipeline that would do some reformatting of the samplesheet. I understand that can I use the Pre-run script on th Advanced settings section:

`prePipelineScript.R ${params.input}`

but it doesn’t like it:

> ${params.input}: bad substitution.

How do I specify a parameter (such as $params.input) as parameter of the pre script?

---

<div class="post-metadata">

### Author: ![Adam\_Talbot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/adam_talbot/32/62_2.png) [@Adam\_Talbot](https://community.seqera.io/u/Adam_Talbot)
#### Post date: [October 17, 2024, 2:49pm UTC](https://community.seqera.io/t/how-to-access-the-samplesheet-in-the-seqera-pre-run-script/1281/2 "2024-10-17T14:49:17Z")

</div>

The pre-run script is a bash script and it doesn’t have access to the params yet because Nextflow hasn’t started yet and so `params` doesn’t exist.

Is there any reason you don’t put `prePipelineScript.R` as your first process in your pipeline?

---

<div class="post-metadata">

### Author: ![ramirobarrantes](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/ramirobarrantes/32/717_2.png) [@ramirobarrantes](https://community.seqera.io/u/ramirobarrantes)
#### Post date: [October 17, 2024, 4:56pm UTC](https://community.seqera.io/t/how-to-access-the-samplesheet-in-the-seqera-pre-run-script/1281/3 "2024-10-17T16:56:37Z")

</div>

Thank you @Adam_Talbot, thank you. The thing is that the sample sheet is going to be modified. The full story is that I can get one of four different types sample sheets (coming from four different instruments). My script will take the samplesheet and change it to another samplesheet with the correct format for the pipeline to work with. So far I have been doing.

prePipelineScript.R instrumentSampleSheet.csv

With creates another samplesheet: pipelineSampleSheet.csv, which I then use on my pipeline.

What can I do?

---

<div class="post-metadata">

### Author: ![Adam\_Talbot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/adam_talbot/32/62_2.png) [@Adam\_Talbot](https://community.seqera.io/u/Adam_Talbot)
#### Post date: [October 18, 2024, 10:07am UTC](https://community.seqera.io/t/how-to-access-the-samplesheet-in-the-seqera-pre-run-script/1281/4 "2024-10-18T10:07:07Z")

</div>

I would put them in your pipeline:

```groovy
workflow {
    // Get all samplesheets into separate channels
    a = Channel.fromPath(params.samplesheet_type_a)
    b = Channel.fromPath(params.samplesheet_type_b)

    // Parse each samplesheet as a process
    PARSE_A(a)
    PARSE_B(b)

    // Mix them all into a single channel
    all_samplesheets = Channel.empty()
        .mix(PARSE_A.out)
        .mix(PARSE_B.out)
        .ifEmpty {
            error "No valid samplesheet found!"
        }

    // Continue with your pipeline!
    DO_STUFF(all_samplesheets)
}

```
