How to use the googleapis.google.sheets function in googleapis

To help you get started, we’ve selected a few googleapis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Giveth / giveth-bot / pointsbot.js View on Github external
)
      pointError.code = 'POINTS_OVER_MAXIMUM'
      throw pointError
    }

    if (!point_types.includes(type)) {
      const typeError = new Error(
        `Invalid point type '${type}'. Please use one of ${point_types}.`
      )
      typeError.code = 'POINT_TYPE_DOES_NOT_EXIST'
      throw typeError
    }

    users = users.split(',')

    const sheets = google.sheets({ version: 'v4', auth })
    var values = []

    users.forEach(user => {
      user = user.trim()
      let { userInRoom, receiver, display_name, multipleUsers } = findReceiver(
        room,
        user
      ) // try to find user

      // handle github users
      const BASE_GITHUB_URL = 'https://github.com/'
      if (user.split(BASE_GITHUB_URL)[1]) {
        receiver = user
        ;(userInRoom = true), (multipleUsers = false)
      }
github keenethics / keenethics / server / get-info-from-googleapis.js View on Github external
const getSheets = memoize(async (spreadsheetId) => { // TEAM_SHEET_ID
  const client = await getClient(CREDS_FILE, googleScopes);

  const sheets = google.sheets('v4');

  const table = await sheets.spreadsheets.values.batchGet({
    auth: client,
    spreadsheetId,
    ranges,
  });

  const result = _.get(table, 'data', {});
  // eslint-disable-next-line
  result._date = Date.now();

  return result;
});
github urbancups / node-sheets / src / sheets.js View on Github external
async function getRanges(
  auth,
  spreadsheetId,
  ranges,
  fields = 'properties.title,sheets.properties,sheets.data(rowData.values.effectiveValue,rowData.values.formattedValue,rowData.values.effectiveFormat.numberFormat)'
) {
  var sheets = google.sheets('v4');
  const response = await Q.ninvoke(sheets.spreadsheets, 'get', {
    auth: auth,
    spreadsheetId: spreadsheetId,
    // https://developers.google.com/sheets/guides/concepts, https://developers.google.com/sheets/samples/sheet
    fields: fields,
    includeGridData: true,
    ranges: ranges
  });
  const spreadsheet = response.data;
  return spreadsheet;
}
github n8n-io / n8n / packages / nodes-base / nodes / GoogleSheets / GoogleSheet.ts View on Github external
import { IDataObject } from 'n8n-workflow';
import { google } from 'googleapis';
import { JWT } from 'google-auth-library';

const Sheets = google.sheets('v4'); // tslint:disable-line:variable-name

export interface ISheetOptions {
	scope: string[];
}

export interface IGoogleAuthCredentials {
	email: string;
	privateKey: string;
}

export interface ISheetUpdateData {
	range: string;
	values: string[][];
}

export interface ILookupValues {
github nprapps / dailygraphics-next / lib / sheetOps.js View on Github external
return str;
    }
  }
  if (str.match(/^(-?(0?\.0*)?[1-9][\d\.,]*|0)$/)) {
    //number, excluding those with leading zeros (could be ZIP codes or octal)
    var n = Number(str.replace(/,/g, ""));
    if (!isNaN(n)) return n;
    return str;
  }
  if (str.toLowerCase() == "true" || str.toLowerCase() == "false") {
    return str.toLowerCase() == "true" ? true : false;
  }
  return str;
};

var api = google.sheets("v4");

var getSheet = async function(spreadsheetId) {

  var auth = await getClient();

  var COPY = {};

  var book = (await api.spreadsheets.get({ auth, spreadsheetId })).data;
  var { sheets, spreadsheetId } = book;
  var ranges = sheets
    .map(s => `${s.properties.title}!A:AAA`)
    .filter(s => s[0] != "_"); // filter out sheets prefixed with _
  var response = await api.spreadsheets.values.batchGet({
    auth,
    spreadsheetId,
    ranges,
github ReactFinland / graphql-api / utils / generate-hotel-stays.js View on Github external
function convertToDateRanges(auth) {
  const spreadsheetId = "1lgRRou8qPL3yylT5MMz3IXZBtGeq_g9sqruE4x3qzqY";
  const sheets = google.sheets({ version: "v4", auth });

  sheets.spreadsheets.values.get(
    {
      spreadsheetId,
      range: "2019 Speakers!A4:I",
    },
    (err, res) => {
      if (err) {
        return console.log("The API returned an error: " + err);
      }

      const rows = res.data.values;
      if (rows.length) {
        const keys = rows[0];
        const values = rows.slice(1);
        const people = toObject(keys, values).map(
github Financial-Times / engineering-progression / script / deploy-google-sheets.js View on Github external
async function createGoogleSheetsClient() {
	const auth = await google.auth.getClient({
		scopes: [
			'https://www.googleapis.com/auth/spreadsheets'
		]
	});
	return google.sheets({
		version: 'v4',
		auth
	});
}
github NGRP / node-red-contrib-viseo / node-red-contrib-google-spreadsheet / google-spreadsheet.js View on Github external
node.auth.authenticate((auth) => {
            sheets = google.sheets({version: 'v4', auth});
            parameters.auth = auth;

            if      (action === "clear" || (action === "set" && config.method === "new")) return queryClear();
            else if (action === "get") return queryGet();
            else if (action === "set") return querySet(); 
            else if (action === "cell") return queryCell(); 
        })
    } catch (ex){
github google / ground-platform / functions / common / spreadsheet.js View on Github external
*
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
'use strict';

const { google } = require('googleapis');
const util = require('util');

const sheets = google.sheets('v4');

const ELEMENT_ID_COLUMN_METADATA_KEY = 'elementId';
const RECORD_ID_ROW_METADATA_KEY = 'recordId';
const LAT_COLUMN_ID = '_latColumn';
const LNG_COLUMN_ID = '_lngColumn';
const GEOPOINT_LAT = '_latitude';
const GEOPOINT_LNG = '_longitude';
const INSPECT_OPTS = {compact: true, depth: 5};

function columnElementIdsRequest() {
  return {
    "dataFilters": [
      {
        "developerMetadataLookup": {
          "locationType": "COLUMN",
          "locationMatchingStrategy":