Skip to content

Instantly share code, notes, and snippets.

View kmelve's full-sized avatar
💬
is typing

Knut Melvær kmelve

💬
is typing
View GitHub Profile
@kmelve
kmelve / import_json_from_sanity_appsscript.js
Last active September 22, 2022 07:31 — forked from paulgambill/import_json_appsscript.js
Adjusted script for working with the Sanity API
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
<script context="module">
import blocksToHtml from '@sanity/block-content-to-html'
import client from '../../sanityClient'
import serializers from '../../components/serializers'
export function preload({ params, query }) {
const projection = `{
...,
excerpt[]{
...
}