![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@yawnxyz/sheetlog
Advanced tools
Sheet.log is a simple console.log-like logger — think Sentry — to Google Sheets with a modified SpreadAPI script.
This is ideal for projects and prototypes where Sentry is too heavy, and you just want a semi-public log dump. Google Sheets is great because they have filtering, formulas, graphing, and more stuff built in.
Google Sheets supports up to roughly 200,000 cells per sheet (I think), which makes sheet.log perfect for toy projects and MVPs that need a faux, persisted "database"
Sheet.log is built on top of the excellent SpreadAPI library, which is a Google Apps Script library that turns any Google Sheets into a data store.
yarn add --dev @yawnxyz/sheetlog
sheet.setup({sheetUrl: "some url"})
sheet.log({some: "data"})
to your code, and it'll log to the Logs
sheet!To start logging data to your Google Sheet:
import sheet from '@yawnxyz/sheetlog';
sheet.log({Name: "First Name"})
This appends all data to the Logs
tab, and requires a column named Name
to exist.
The .log function is used to log data to the specified sheet. It accepts the following parameters:
Example:
const payload = { name: 'John', age: 30 };
const options = { sheet: 'Users', method: 'POST' };
sheet.log(payload, options);
The .update function is used to update existing data in the specified sheet. It accepts the same parameters as .log and sets the method to "UPSERT".
Example:
const payload = { id: 123, name: 'Jane', age: 25 };
const options = { sheet: 'Users' };
sheet.update(payload, options);
The .add function is used to add new data to the specified sheet. It accepts the same parameters as .log, but turns any new keys in the object into columns
Example:
const payload = { name: 'Alice', age: 28 };
const options = { sheet: 'Users' };
sheet.add(payload, options);
The .find function is used to find data in the specified sheet based on the provided idColumn and id. It accepts the idColumn, id, and returnAllMatches parameters.
This method returns an object, but setting returnAllMatches=true
will instead return an array of all matches.
Example:
const idColumn = 'id';
const id = 123;
const returnAllMatches = true;
sheet.find(idColumn, id, returnAllMatches);
To use a custom sheet, you can do this:
import sheet from '@yawnxyz/sheetlog';
sheet.log({Name: "First Name"},
{
sheet: "Signups", // custom sheet name
})
This will work as long as you have the appropriate Google Sheets tabs set up — with the correct spelling of the sheet name and column names.
You can also setup the custom sheet, then log data to the new configuation:
sheet.setup({
sheet: "sheetName", // custom default sheet name
sheetUrl: "some custom sheet url",
logPayload: false, // log the payload back to console?
useSqid: false, // creates a sqid based on timestamp for easy referencing
method: "POST", // default method is POST, but can use "DYNAMIC_POST" for adding more columns, etc.
})
sheet.log({ Name: "Test Name" });
You can also create and set up multiple Sheets:
import { Sheet } from '@yawnxyz/sheetlog';
const errorSheet = new Sheet();
errorSheet.setup({
sheetUrl: "https://googleappscriptlink",
sheet: "Errors"
})
const signupSheet = new Sheet();
signupSheet.setup({
sheetUrl: "https://googleappscriptlink",
sheet: "Signups"
})
errorSheet.log({ Message: error.message });
signupSheet.log({ Name: "New Signup Name" });
Many thanks to SpreadAPI for sharing the code for free (and even letting everyone know you CAN do this at all, without any expensive third party tools or the official API!). All credit goes to them.
FAQs
a google sheets logging system
We found that @yawnxyz/sheetlog demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.