-
-
Save neil-lobo/e632aae751fe7aec8bbc29a42c585015 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { google } = require("googleapis"); | |
const fs = require("node:fs"); | |
google.options({ | |
http2: true, | |
}); | |
const auth = new google.auth.GoogleAuth({ | |
credentials: JSON.parse(fs.readFileSync("credentials.json").toString()), | |
scopes: ["https://www.googleapis.com/auth/spreadsheets"], | |
}); | |
const client = google.sheets({ | |
version: "v4", | |
auth, | |
}); | |
async function main() { | |
let res; | |
res = await client.spreadsheets.values.get({ | |
spreadsheetId: "[sheet ID]", | |
range: "A1:B1", | |
}); | |
console.log("finish get", res.status); | |
res = await client.spreadsheets.values.clear({ | |
spreadsheetId: "[sheet ID]", | |
range: "A1:B1", | |
}); | |
console.log("finish clear", res.status); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment