当前位置: 首页 > 编程日记 > 正文

完成工作表-使用Google Spreadsheets作为数据后端

by Gilad Dayagi

通过吉拉德·达亚吉

完成工作表-使用Google Spreadsheets作为数据后端 (Get Sheet Done — using Google Spreadsheets as your data backend)

If you want to rapidly prototype your next web apps, try using Google Spreadsheets as your data backend.

如果您想快速制作下一个Web应用程序的原型,请尝试使用Google Spreadsheets作为数据后端。

With a small library I created called get-sheet-done, you can have a free cloud database with GUI editor up and running in less than 5 minutes.

使用我创建的一个名为get-sheet-done的小型库,您可以在5分钟内启动并运行GUI编辑器的免费云数据库。

完成工作表背后的故事 (The story behind Get Sheet Done)

A while back, I needed to quickly prototype a web app that could display structured data. The catch was that these data had to be frequently edited by a non-technical person.

前一阵子,我需要快速制作一个可以显示结构化数据的Web应用程序原型。 值得注意的是,这些数据必须由非技术人员经常进行编辑。

Since this was a prototype, I was looking for a solution that would give me the most bang for the buck, when taking into account development time and maintenance costs.

由于这是一个原型,因此我在考虑开发时间和维护成本的情况下,一直在寻找一种能够最大程度地物有所值的解决方案。

I considered several solutions, including using a full backend-as-a-service approach that stored the data as a file in Dropbox. Then I chose a somewhat non-orthodox solution: I stored the data in a Google spreadsheet.

我考虑了几种解决方案,包括使用完整的后端即服务方法,将数据作为文件存储在Dropbox中。 然后,我选择了一种非传统的解决方案:我将数据存储在Google电子表格中。

基于电子表格的数据库什么时候是合适的解决方案? (When is a spreadsheet-based database a suitable solution?)

Using Google spreadsheets as a database for web applications in not a mainstream solution, and it may or may not be suitable for your next project.

在主流解决方案中,使用Google电子表格作为Web应用程序的数据库不是主流解决方案,它可能适合也可能不适合您的下一个项目。

To help you decide whether this is a good option, I’ve put together the following list of considerations.

为了帮助您确定这是否是一个不错的选择,我整理了以下注意事项列表。

Remember: we’re talking about a spreadsheet, which works great for structured, tabular data. But doesn’t work well for a document / object store.

请记住:我们所谈论的是电子表格,该电子表格非常适合结构化的表格数据。 但是不适用于文档/对象存储。

Other than that, here are some pros and cons to consider:

除此之外,还有一些要考虑的利弊:

优点 (Pros)

  • It’s free

    免费
  • Very easy to set up — no need for API keys or complicated SDKs

    设置非常简单-无需API密钥或复杂的SDK
  • Zero maintenance

    零维护
  • You get a data editing GUI for free

    您免费获得数据编辑GUI
  • You get write access management for free

    您免费获得写访问权限管理
  • Can include internal calculations using spreadsheet functions

    可以包括使用电子表格功能的内部计算
  • The app that uses the data can be easily upgraded in a later phase to use a real database, as data is exposed as standard JSON

    使用数据的应用程序可以在以后的阶段轻松升级以使用真实数据库,因为数据以标准JSON形式公开
  • Some level of automation can be achieved by using apps-scripts in combination with time-driven triggers

    通过将应用程序脚本与时间驱动的触发器结合使用,可以实现某种程度的自动化

  • It can be combined with Google Forms for data collection

    它可以与Google表单结合使用以收集数据

缺点 (Cons)

  • No server-side filtering logic to talk about

    没有服务器端过滤逻辑可以谈论
  • All the data you want to access has to be publicly accessible

    您要访问的所有数据必须可以公开访问
  • The entire database is manually-editable, so a human error may break the application. For example, if someone accidentally changes the label of some field, it won’t be available for the application.

    整个数据库都是可手动编辑的,因此人为错误可能会破坏应用程序。 例如,如果有人不小心更改了某个字段的标签,则该标签将不适用于该应用程序。

    This can be partially remedied by protecting the critical cells

    通过保护关键细胞可以部分补救

  • You can have up to 2 million cells in a spreadsheet

    电子表格中最多可以包含200万个单元格

我是如何实现的 (How I implemented this)

I couldn’t find a lot of information nor good libraries for easily reading data from a Google spreadsheet. So I decided to roll my own solution. It is now available on npm as the get-sheet-done package.

我找不到大量信息,也找不到很好的库来轻松地从Google电子表格中读取数据。 因此,我决定推出自己的解决方案。 现在可以在npm上将其作为get-sheet-done软件包使用 。

My implementation is based on the fact that once a spreadsheet is published to the web, it’s also available as a standard RSS feed, which can be fetched and parsed.

我的实现基于以下事实:将电子表格发布到网络后,它也可以作为标准的RSS提要使用,可以进行提取和解析。

One complication is you have to fetch it using JSONP or somehow handle CORS. I chose to go with JSONP and use the fetch-jsonp library to manage this, so there’s no need for special measures.

一种复杂的情况是您必须使用JSONP或以某种方式处理CORS来获取它。 我选择使用JSONP并使用fetch-jsonp库进行管理,因此无需采取特殊措施。

如何使用它 (How to use it)

Here’s what you need to do to get a simple editable database for your web app:

这是为Web应用程序获取简单的可编辑数据库所需的操作:

  1. Create a google spreadsheet with some data

    创建包含一些数据的Google电子表格
  2. Publish the sheet to the web: File -> Publish to the web.

    将工作表发布到Web: File -> Publish to the Web。

    Note the document ID from the URL

    记下URL中的文档ID

  3. Install the package: npm install --save get-sheet-done

    安装软件包: npm install --save get-sheet-done

  4. Get the data:

    获取数据:
import GetSheetDone from 'get-sheet-done'
GetSheetDone.labeledCols(DOCUMENT_ID).then(sheet => console.log(sheet))

5. Profit!

5.利润!

Note that there are three functions you can use to fetch the data, depending on how it should be parsed: raw 2d array, array of objects, object of objects.

请注意,根据应如何解析数据,可以使用三个函数来获取数据:原始2d数组,对象数组,对象对象。

Here’s a live demo you can play with.

这是您可以玩的现场演示 。

It’s worth considering using Google Spreadsheets as a data source for a web application, especially if you’re just building a quick prototype. It has some unique advantages, and implementation is easy with (or without) my library.

值得考虑使用Google Spreadsheets作为Web应用程序的数据源,尤其是在您仅构建快速原型的情况下。 它具有一些独特的优点,并且无论有没有我的库,实现起来都很容易。

Let me know in the comments if you found this library useful and whether there are missing features.

在评论中让我知道您是否发现此库有用,以及是否缺少功能。

翻译自: https://www.freecodecamp.org/news/get-sheet-done-using-google-spreadsheets-as-your-data-backend-650ba23dc6d9/

相关文章:

BIEE-CSS样式大全

字体属性:(font) 大小 {font-size: x-large;}(特大) xx-small;(极小) 一般中文用不到,只要用数值就可以,单位:PX、PD 样式 {font-style: oblique;}(偏斜体) italic;(斜体) normal;(正常) 行高 {line-height: normal;}(正常) 单位&…

基于verilog的FPGA编程经验总结(XILINX ISE工具)

1.用ISE仿真的时候.所用变量一定要初始化. ISE默认初始量为"XXXXX", 而Quarters是默认为"00000"的, 其实实际上, 下到FPGA里后也是默认为0的,只是可以说ISE严谨得令人DT吧.比如说用一个累加器, result ABresult ,必须保证在某一刻A, B, result都为定值时,…

6 OC 中的isa 指针

目录 一 isa 指针 二 类对象中的superclass 一 isa 指针 isa 指针 ,OC 中的对象都是有的 如下图所示,实例对象isa 指针指向 类对象,类对象的isa 指针指向 元类对象 二 类对象中的superclass superclass 有什么用呢? 比如说创…

btf-raft共识算法_了解Raft共识算法:学术文章摘要

btf-raft共识算法by Shubheksha通过Shubheksha 了解Raft共识算法:学术文章摘要 (Understanding the Raft consensus algorithm: an academic article summary) This post summarizes the Raft consensus algorithm presented in the paper In Search of An Underst…

iOS asset 中定义颜色,xib中便捷访问

在aseet 中定义一个颜色 这样就可以在xib 中访问颜色了,这样就不用重复的去输入

三种序列化方式性能比较

一下代码比较了二进制序列化、xml序列化、Protobuf序列化的运行时间,可是代码显得十分冗余,是否有大神可以指点一二,万分感谢 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; usi…

mac mini 装UBUNTU后没有WIFI解决办法

1、在终端中运行如下命令,重新安装b43相关的全部驱动和firmware: 复制代码代码如下:sudo apt-get install bcmwl-kernel-source #Broadcom 802.11 Linux STA 无线驱动源sudo apt-get install broadcom-sta-commonsudo apt-get install broadcom-sta-sourcesudo apt-…

区块链c端应用小程序_区块链如何真正起作用? 我建立了一个应用程序向您展示。...

区块链c端应用小程序by Sean Han通过肖恩韩 区块链如何真正起作用? 我建立了一个应用程序向您展示。 (How does blockchain really work? I built an app to show you.) According to Wikipedia, a blockchain is:根据维基百科,一个区块链是&#xff1…

HDU 4913 Least common multiple

/* hdu4913 Least common multiple http://acm.hdu.edu.cn/showproblem.php?pid4913 离散化 线段树 统计逆序数思想 tips: 1、线段树中一定要到处都取模&#xff0c;否则wa。。。 2、lazy是乘积的形式出现&#xff0c;不是加和*/ #include <cstdio> #include <algori…

JS ES6 实用笔记

微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 这篇博文我会一直更新。 一.导出导入的两中方式 1.export //demo1.js export const a 6 导入语法为&#xff1a; import {a} form demo1 2.export default //demo2.js export default const b 6 …

extjs editgrid增加一行

Ext.onReady(function(){ /* * EditorGridPanel的工作过程 * 1、用户点击单元格 * 2、单元格按照预设的组件显示单元格的内容并处于编辑状态 * 3、离开单元格的编辑状态 * 4、更新编辑后的内容&#xff0c;出现三角号表示已经被修改过 * 5、程序内部变化&#xff1a;将记录设置…

unity 骨骼击碎_保证击碎$ 100挑战的创新策略

unity 骨骼击碎by Glenn Gonda由Glenn Gonda 保证击碎$ 100挑战的创新策略 (A Creative Strategy Guaranteed to Crush the $100 Challenge) Before I became a software engineer, I made my living as a recording studio engineer. I have a non-traditional background an…

mac下安装libpng环境

用go写一个爬虫工具时需要使用一个go的库&#xff0c;而这个库有需要使用libpng库&#xff0c;不然编译就会提示说 png.h找不到等之类的信息&#xff0c;于是想到应该和windows一样需要安装gcc环境&#xff0c;然后让gcc里安装libpng这个库&#xff0c; 解决办法&#xff1a; 终…

linux oracle修改编码utf8

$ sqlplus /nolog SQL> connect sys/oracle as sysdba SQL> startup 如何设置ORACLE数据库的编码&#xff08;ZHS16GBK&#xff09;修改成UTF8 SQL> shutdown immediate; SQL> startup mount; SQL> alter system enable restricted session; SQL> alter sy…

Vue.js 数据绑定渲染Demo

微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 <div id"app">{{ message }} </div>var app new Vue({el: #app,data: {message: Hello Vue!} })Hello Vue!

angular搭建项目步骤_建立健康的Angular项目应采取的步骤

angular搭建项目步骤by Ashish Gaikwad通过Ashish Gaikwad 建立健康的Angular项目应采取的步骤 (Steps you should take to build a healthy Angular project) 使用Jenkins SonarQube创建您的“ Angular Fitbit” (Create your “Angular Fitbit” with Jenkins SonarQube) …

数据库的三大范式和事物

来源&#xff1a;http://blog.csdn.net/w__yi/article/details/19934319 1.1 第一范式&#xff08;1NF&#xff09;无重复的列 1.2 第二范式&#xff08;2NF&#xff09;属性完全依赖于主键 [ 消除部分子函数依赖 ] 1.3 第三范式&#xff08;3NF&#xff09;属性不依赖于其它非…

过滤器和包装器

作者&#xff1a;禅楼望月 过滤器要做的事情 请求过滤器 完成安全检查 重新格式化请求首部或体 建立请求审计或日志响应过滤器 压缩响应流 追加或修改响应流 创建一个完全不同的响应注意不能把过滤器的顺序依赖性硬编码进程序中&#xff0c;它应该由DD控制。 过滤器很像Servlet…

Missing space before value for key 'path'vue.js解决空格报错

微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 找到 webpack.base.config.js文件注释掉下面的东西&#xff01;&#xff01; module: { rules: [ /*{ test: /\.(js|vue)$/, loader: eslint-loader, enforce: "p…

现代hy-9600音响_从音响工程师到软件工程师-为什么我要学习编码

现代hy-9600音响by Kalalau Cantrell通过Kalalau Cantrell 从音响工程师到软件工程师-为什么我要学习编码 (From Sound Engineer to Software Engineer — Why I’m Learning to Code) I seriously started teaching myself to code several months ago. I say “seriously” …

微信服务号、公众号、企业号注册

转载于:https://www.cnblogs.com/zhoulaoshi/p/6536850.html

a标签onclick事件解析

微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 简单介绍<a>标签的常用点击事件的写法及作用 a href"javascript:void(0);" οnclick"js_method()" //javascript:void(0);作用是返回undefined&#xff0c;地址不发生跳转&am…

安卓版文字扫描识别软件

安卓版文字扫描识别软件 文字识别软件被越来越多的人使用&#xff0c;在使用的过程中也发现了一些问题。总结这些问题发现&#xff0c;很多人对软件能够批量识别这个问题比较关注。如果实现批量识别就可以节省时间。但是一些软件还不能实现批量识别&#xff0c;还有的软件能够做…

中级前端笔试_在短短8个月内如何获得中级前端开发人员的角色

中级前端笔试by Matthew Burfield通过马修伯菲尔德(Matthew Burfield) 在短短8个月内如何获得中级前端开发人员的角色 (How I got a mid-level front end developer role in just 8 months) Three weeks ago I landed a mid-level front-end developer role at a startup. Our…

用stm32f10x建立新的工程重要步骤

stm32f10x系列新建空的工程主要原理&#xff1a; 1.添加启动文件 不同的芯片类型的启动文件的容量是不同的&#xff0c;选择适合该芯片的容量作为启动文件。 注意&#xff1a;启动文件是汇编语言编写的&#xff0c;所以文件的后缀名为.s 2.添加时钟配置 配置文件 stm32f10x.的系…

随机生成6位图片验证码

1. [代码][C#]代码 /// <summary> /// PicHandler1 的摘要说明 /// </summary> public class PicHandler1 : IHttpHandler, IRequiresSessionState { private string mCheckNo string.Empty; protected ImgBuilder _ImgBuilder new I…

html 页面传值

微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 直接上代码&#xff0c;JS保存全局变量的三种方式。 创建一个新的JS文件&#xff0c; //quanju.js window.localStorage.JQa"JQA"; window.localStorage.setItem(JQb,JQB);//利用localStora…

node.js的开发流程_Node.js子流程:您需要了解的一切

node.js的开发流程by Samer Buna通过Samer Buna Node.js子流程&#xff1a;您需要了解的一切 (Node.js Child Processes: Everything you need to know) 如何使用spawn()&#xff0c;exec()&#xff0c;execFile()和fork() (How to use spawn(), exec(), execFile(), and fork…

对象存在性检测集中管理

在中大型业务系统中&#xff0c; 常常需要从数据库中查询某个实体对象。 在进行处理之前&#xff0c; 必须先检测该实体是否存在&#xff0c;以增强系统的健壮性。 不过&#xff0c; 检测代码充斥在主业务流程中又会大大降低业务逻辑的清晰性&#xff0c; 最好集中起来进行管理…

20155204 2016-2017-2 《Java程序设计》第3周学习总结

20155204 2016-2017-2 《Java程序设计》第3周学习总结 教材学习内容总结 一个原始码中可以有多个类定义&#xff0c;但只能有一个公开类。留心Scanner对于每一种类型的nextxxxx()方法以Java开头的都是API提供的类使用Integer.valueOf()也是为基本类型建立打包器的方式之一Integ…