---
title: "How to print out all project keys"
canonical: "https://support.appfire.com/space/SUPPORT/436273253/How%20to%20print%20out%20all%20project%20keys"
format: markdown
---
In this article, you will find out how to write a script that will loop through all existing projects and save all project names and project keys to a .csv file. This script is compatible with **Power Scripts for Jira for Server/DC/Cloud.**

1. First, you have to assign **allProjects()** to a string which you will use to access all projects you have in Jira.

```
string allpro = allProjects();
```


2. Then, you have to create a file where all project keys will be saved. You can also add columns “Project name” and “Project key” for clarification.

```
//create a file with columns first
printInFile("sheet1.csv", + "Project Name " + "  Project Key  ");
```


3. Now, you have to loop through all existing projects. For this, we use the **admProjectProperties(pkey)** method.

```
//loop through all existing projects here
for(int x = 0; x < size(allpro); x++){

    JProject prj = admProjectProperties(allpro.getElement(allpro, x)); // get project Key
    printInFile("sheet1.csv", prj.name + " " + prj.key ); // save data to a file
    runnerLog("Project Name : " + prj.name + "   Project Key : " + prj.key);

}
```


4. After you create the above script and run it, you should see all project names and keys in the Editor console. Additionally, a .csv file will be created with the name “sheet1.csv” on the left in your Files.

![image](media://e0a7c59d-6b74-4b1a-9277-1516104ff72b)


You can also edit this script and adjust it to your needs using other data that is available to return when using `admProjectProperties`. You can find more details here: [https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15480981](https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15480981)


The final code should look like this : 

```
string allpro = allProjects();

//create a file with columns first
printInFile("sheet1.csv", + "Project Name " + "  Project Key  ");

//loop through all existing projects here
for(int x = 0; x < size(allpro); x++){

    JProject prj = admProjectProperties(allpro.getElement(allpro, x)); // get project Key
    printInFile("sheet1.csv", prj.name + " " + prj.key ); // save data to a file
    runnerLog("Project Name : " + prj.name + "   Project Key : " + prj.key);

}
```