Giter Club home page Giter Club logo

gspread-objects1d's Introduction

Gspread-Objects1d

Work with 1-dimensional rows, columns and non-adjacent cells in Google Sheets

To use, go to Resources > Library in the Google Sheets script editor and enter the following project key: MS8m0Cjb7P7PEESdMy2qrTYoHEfXZl5VD

function myFunction() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var row = Objects1d.getRow(sheet, 1, 1);     //Get row 1, header size is 1
  var values = row.getValues();                //Returns 1d array of values, excluding the header
  row.setValue(1, 'x');                        //Value not set in spreadsheet yet (uncomitted)
  row.setValue(2, 'y');                        //Value not set in spreadsheet yet (uncomitted)
  row.commit();                                //Values from previous two lines set in single request to gspread API (more efficent).
  values[4] = 'no';
  values[6] = 'yes';
  row.setValues(values);                       //Set values using a 1d array (committed)
  row.getCells();                              //Returns 1d array of cell objects
  row.count();                                 //List of values not including headers
  row.addValue('value');                       //Appends the value to the next empty column in the row (uncomitted)
  row.addValueIfNotExists('value')             //Adds a value to a row if it doesn't already exist (uncomitted)
  row.addValueIfNotExists(['value1', 'value2'])//Runs add valueIfNotExists for each value in the array (uncomitted)
  row.getCell(1);                              //Returns a cell object by its index in the row
  row.getHeader();                             //Returns a cell object of the row header
  var column = Objects1d.getColumn(sheet, 1, 'Name', 1, 1); //Returns a column by the header name 'Name', with headers in Row 1. Header Size: 1 and Column 1 contains headers to enable ORM
  var name = column.date //Returns cell in column with row header 'date'
}

In addition to rows and columns, objects1d also allows interations with Cell Collections (non-adjacent cells).

Lots more features to be documented soon, in the meantime check out the code and the sheets documentation here:

https://docs.google.com/macros/library/d/MS8m0Cjb7P7PEESdMy2qrTYoHEfXZl5VD/4

gspread-objects1d's People

Contributors

primal100 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.