Sha256: b56db30a3443e1d17704836438032be9e9f87e82d6b774293ce0d1fb6e69ad23
Contents?: true
Size: 1.09 KB
Versions: 95
Compression:
Stored size: 1.09 KB
Contents
/* // Custom JS | written by https://github.com/wdzajicek // © 2020 Kankakee Community College // =================================================== */ // Modules' default function stores our Google Sheet response in sessionStorage to be retrieved later // Each key gets set to a column in our data // Each key's value gets set to the corresponding cell in the row below // ==================================================================== function cacheResponse(response) { // response from Google API's spreadsheet.values.get() method const VALUES = response.result.values; // This is where the table's data is in a Sheets response in Sheets API V4 const TABLE_HEADER_ROW = VALUES[1]; // 2nd row in the sheet (first row is instructions to the user) const TABLE_BODY_ROW = VALUES[2]; // The only row of data in our table for (let i = 0, len = TABLE_BODY_ROW.length; i < len; i++ ) { const cell = TABLE_BODY_ROW[i]; const column = TABLE_HEADER_ROW[i]; window.sessionStorage.setItem(column.replace(' ', '-'), cell); } //window.sessionStorage.clear(); } export default cacheResponse;
Version data entries
95 entries across 95 versions & 2 rubygems