Google Sheets

Create the Google Sheets worksheet using Python

Learn how to create a new worksheet in Google Sheets using Python and the gspread library. This recipe covers the steps to add a worksheet to an existing spreadsheet by specifying its title, number of rows, and columns. Follow these instructions to efficiently manage and organize your data by adding new worksheets programmatically within your Google Sheets.

Required packages

You need below packages to use the code generated by recipe. All packages are automatically installed in MLJAR Studio.

gspread>=6.1.2

Interactive recipe

You can use below interactive recipe to generate code. This recipe is available in MLJAR Studio.

In the below recipe, we assume that you have following variables available in your notebook:

  • sh (type Spreadsheet)

Python code

# Python code will be here

Code explanation

  1. Create the worksheet
« Previous
Open worksheet