---
slug: "gas-get-spreadsheet-data-as-dictionary-list"
title: "Retrieve Google Spreadsheet Content as a List of Dictionaries using GAS"
description: "Shell script to launch Chrome on macOS with a fixed window size from the command line — combine `--window-size` and `--window-position`."
url: "https://www.ytyng.com/en/blog/gas-get-spreadsheet-data-as-dictionary-list"
publish_date: "2022-10-25T00:04:56Z"
created: "2022-10-25T00:04:56Z"
updated: "2026-05-11T13:21:45.921Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/db14fd6889864396bb2b0273ccb713fe.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# Retrieve Google Spreadsheet Content as a List of Dictionaries using GAS

Certainly! Here is the translation of the provided Japanese blog article into English:

---

```Javascript
function myFunction() {
  var data = getDataOfSheetId('xxxxx-xxxxxxxxxxxxxxxxxxxx_xxxxxx', 0);
  console.log(data);
}

function getDataOfSheetId(spreadsheetId, sheetIndex) {
  var book = SpreadsheetApp.openById(spreadsheetId);
  var sheet = book.getSheets()[sheetIndex];
  console.log(sheet.getName());
  var [rows, columns] = [sheet.getLastRow(), sheet.getLastColumn()];
  var data = sheet.getRange(1, 1, rows, columns).getValues();
  var header = data[0];
  data.shift();
  return data.map(function(row) {
    return header.reduce(function(o, h, i) {
      o[h] = row[i];
      return o;
    }, {});
  });
}
```

Reference:

[javascript - How to get data from google sheets as an array of dictionary - Stack Overflow](https://stackoverflow.com/questions/57269986/how-to-get-data-from-google-sheets-as-an-array-of-dictionary)

---

Feel free to let me know if you need any further assistance!
