# ODK Central to Google Sheets

**URL:** <https://forum.getodk.org/t/odk-central-to-google-sheets/42072>\
**Category:** Development\
**Created:** [June 27, 2023, 10:35am UTC](https://forum.getodk.org/t/odk-central-to-google-sheets/42072 "2023-06-27T10:35:32Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Tyler\_Depke](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/tyler_depke/32/17598_2.png) [@Tyler\_Depke](https://forum.getodk.org/u/Tyler_Depke)\
**Post date:** [July 17, 2025, 2:48pm UTC](https://forum.getodk.org/t/odk-central-to-google-sheets/42072/4 "2025-07-17T14:48:59Z")

</div>

Something that I thought would take some serious time was [solved by chatGPT in one prompt](https://chatgpt.com/share/68790ace-8b38-8003-b3fa-bd0b4677a5bb).

Step by Step Instructions

1. Open a new Google Sheet
2. Extensions --\>App Script
3. Copy and Paste the following code in code.gs
4. Replace the 4 const values in lines 2-5 with your values
5. Run Code and approve permissions
6. Check your google sheet and celebrate! 🙌

I haven't used this extensively but it works for my basic test!

```auto
// CONFIGURATION
const ODK_URL = 'https://your-odk-server.org/v1/projects/1/forms/myform/submissions.csv';
const ODK_USERNAME = 'yourusername';
const ODK_PASSWORD = 'yourpassword';
const SHEET_NAME = 'ODK Data'; // Sheet name to write to

function importODKData() {
  const encodedCreds = Utilities.base64Encode(ODK_USERNAME + ':' + ODK_PASSWORD);

  const options = {
    method: 'get',
    headers: {
      'Authorization': 'Basic ' + encodedCreds
    },
    muteHttpExceptions: true
  };

  const response = UrlFetchApp.fetch(ODK_URL, options);
  const code = response.getResponseCode();

  if (code !== 200) {
    Logger.log("Error fetching data: " + code + " - " + response.getContentText());
    return;
  }

  const csvData = Utilities.parseCsv(response.getContentText());
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(SHEET_NAME) || 
                SpreadsheetApp.getActiveSpreadsheet().insertSheet(SHEET_NAME);

  sheet.clearContents();
  sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
}

```

> **[ChatGPT - Import ODK Data Script](https://chatgpt.com/share/68790ace-8b38-8003-b3fa-bd0b4677a5bb)**
>
> Shared via ChatGPT

---

_[View the full topic](https://forum.getodk.org/t/odk-central-to-google-sheets/42072)._
