简体   繁体   中英

Spreadsheet Service: Reading Data

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;
}

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));
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM