Transforms the data of a given Spreadsheet Sheet to JSON.
- The frozen rows are taken as keys for the JSON.
- The data taken for the values is only that after the frozen rows
exportJSON(Spreadsheet)
- transforms the data in the given sheet to JSON.
//Explanation: | |
//Constructor: Accepts an initialValue parameter to set the initial data structure (empty array or object). If the key doesn't exist in local storage, it initializes it with this value. | |
//getStoredData: Returns the stored data or the initialValue if the key doesn't exist. | |
//addItem, updateItem, deleteItem: Methods are updated to handle the initial data structure correctly. | |
//Example usage: Demonstrates the usage of the class with both array and object initial values. | |
class LocalStorageManager { | |
constructor(storageKey, initialValue = {}) { | |
this.storageKey = storageKey; |
class DynamicForm { | |
constructor(keys, saveFunction) { | |
this.keys = keys; | |
this.saveFunction = saveFunction; | |
} | |
render() { | |
const overlay = document.createElement('div'); | |
overlay.id = 'overlay'; | |
overlay.className = 'fixed inset-0 bg-gray-800 bg-opacity-75 flex justify-center items-center'; |
<div className='delete-button' onClick={() => { if (window.confirm('Are you sure you wish to delete this item?')) this.onCancel(item) } } /> |
// Original: https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/ | |
// Usage | |
// 1. Enter sheet name where data is to be written below | |
var sheetName = 'Users' | |
// 2. Run > setup | |
// | |
// 3. Publish > Deploy as web app | |
// - enter Project Version name and click 'Save New Version' | |
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously) |
import { | |
createContext, | |
PropsWithChildren, | |
useContext, | |
useEffect, | |
useRef, | |
useState, | |
} from "react"; | |
// RESOURCES: |
// upload.js, from https://github.com/googledrive/cors-upload-sample | |
// Contributors Steve Bazyl, Mike Procopio, Jeffrey Posnick, Renaud Sauvain | |
// License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Implements Resumable Upload for Google Drive as described by | |
// https://developers.google.com/drive/v3/web/resumable-upload | |
// | |
// Modified by Paul Brewer, Economic and Financial Technology Consulting LLC | |
// Nov. 1 2017 | |
// 1. use Google Drive API V3 instead of V2 |
This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form>
following the example by Martin Hawksey
You should be able to just open index.html
in your browser and test locally.
However if there are some permissions errors you can make a quick html server with python
. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer
. By default this creates a local server at localhost:8000
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
function columnToLetter(column) | |
{ | |
var temp, letter = ”; | |
while (column > 0) | |
{ | |
temp = (column – 1) % 26; | |
letter = String.fromCharCode(temp + 65) + letter; | |
column = (column – temp – 1) / 26; | |
} | |
return letter; |