A port of Apps Script library bmfiddler to Node - Google Sheets
npm install @mcpher/fiddlerFiddler can be used without apps script services, but whenever you access sheets you'll also need gas-fakes on Node which emulates Apps Script built in services. See gas-fakes for more information and related articles and the gas-fakes repository for more information.
npm i @mcpher/fiddler
npm i @mcpher/gas-fakes
#### Authentication
You can use gas-fakes-cli for authentication - see gas-fakes for more information.
For details on using fiddler, see fiddler and related articles. These are written for Apps Script, but gas-fakes emulation on Node means it's exactly the same.
```js
// create a fiddler for a given sheet
const fiddler = new Fiddler(SpreadsheetApp.openById(myssid).getSheetByName("people"));
// do things with the data
fiddler.insertColumn("full name")
fiddler.mapRows (row=> {
row["full name"] = row["first name"] + " " + row["last name"]
return row
})
// dump the data back to the sheet
fiddler.dumpValues()
``
You can also use the preFiddler helper to create a fiddler from a sheet name and id. For details see https://ramblings.mcpher.com/vuejs-apps-script-add-ons/helper-for-fiddler/
`js``
const fiddler = new PreFiddler().getFiddler({ sheetName: "people", id: myssid, createIfMissing: true })