Home > Blockchain >  Spreadsheet Service: Reading Data
Spreadsheet Service: Reading Data

Time:07-17

I am following this tutorial to read data from a Google Spreadsheet. However, I am trying to find some documentation on that method, but I cannot find it. There's an official guide on how to read from a single range, but it doesn't address the specifics for different sheets. Could someone help me read data or offer skeleton code?

This is what I have so far:

function getLatestRotations() {
  const spreadsheet = SpreadsheetApp.openById("<SPREADSHEET ID>");
  const sheet = spreadsheet.getSheetByName("<SHEET NAME>")

  const columnFriday = sheet; //method to get column id?
  const columnSunday = sheet;
  
  rotations = {};
  return rotations;
}

CodePudding user response:

How to get all values in a column

function getLatestRotations() {
  const ss = SpreadsheetApp.openById("<SPREADSHEET ID>");
  const sh = ss.getSheetByName("<SHEET NAME>")
  const column = 1;
  const vs = sh.getRange(1,column,sh.getLastRow()).getValues();
  Logger.log(JSON.stringify(vs));
}
  • Related