![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@googleapis/sheets
Advanced tools
@googleapis/sheets is an npm package that provides a client library for accessing the Google Sheets API. It allows developers to interact with Google Sheets programmatically, enabling them to read, write, and manipulate spreadsheet data.
Read Data from a Spreadsheet
This feature allows you to read data from a specified range in a Google Sheets spreadsheet. The code sample demonstrates how to use the Google Sheets API to fetch data from a specific range in a sheet.
const { google } = require('@googleapis/sheets');
const sheets = google.sheets('v4');
async function readData(auth) {
const request = {
spreadsheetId: 'your-spreadsheet-id',
range: 'Sheet1!A1:D5',
auth: auth,
};
try {
const response = await sheets.spreadsheets.values.get(request);
console.log(response.data.values);
} catch (err) {
console.error(err);
}
}
Write Data to a Spreadsheet
This feature allows you to write data to a specified range in a Google Sheets spreadsheet. The code sample demonstrates how to use the Google Sheets API to update a range of cells with new data.
const { google } = require('@googleapis/sheets');
const sheets = google.sheets('v4');
async function writeData(auth) {
const request = {
spreadsheetId: 'your-spreadsheet-id',
range: 'Sheet1!A1',
valueInputOption: 'RAW',
resource: {
values: [
['Item', 'Cost'],
['Apple', '$1'],
['Banana', '$2'],
],
},
auth: auth,
};
try {
const response = await sheets.spreadsheets.values.update(request);
console.log(response.data);
} catch (err) {
console.error(err);
}
}
Append Data to a Spreadsheet
This feature allows you to append data to a specified range in a Google Sheets spreadsheet. The code sample demonstrates how to use the Google Sheets API to add new rows of data to a sheet.
const { google } = require('@googleapis/sheets');
const sheets = google.sheets('v4');
async function appendData(auth) {
const request = {
spreadsheetId: 'your-spreadsheet-id',
range: 'Sheet1!A1',
valueInputOption: 'RAW',
insertDataOption: 'INSERT_ROWS',
resource: {
values: [
['Orange', '$3'],
['Grapes', '$4'],
],
},
auth: auth,
};
try {
const response = await sheets.spreadsheets.values.append(request);
console.log(response.data);
} catch (err) {
console.error(err);
}
}
The google-spreadsheet package is another popular library for interacting with Google Sheets. It provides a simpler interface for reading and writing data to Google Sheets. Compared to @googleapis/sheets, it abstracts away some of the complexities of the Google Sheets API, making it easier to use for basic operations.
The gsheets package is a lightweight library for accessing Google Sheets. It offers basic functionalities for reading and writing data. While it is not as feature-rich as @googleapis/sheets, it is suitable for simple use cases and quick integrations.
Reads and writes Google Sheets.
$ npm install @googleapis/sheets
All documentation and usage information can be found on GitHub. Information on classes can be found in Googleapis Documentation.
This library is licensed under Apache 2.0. Full license text is available in LICENSE.
We love contributions! Before submitting a Pull Request, it's always good to start with a new issue first. To learn more, see CONTRIBUTING.
Crafted with ❤️ by the Google Node.js team
FAQs
sheets
We found that @googleapis/sheets demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
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.