neptyne.sheet

The sheets present in the spreadsheet modelled as Python collection.

Access with:

import neptyne as nt
sheets = nt.sheets

In addition to the below methods, you can also access sheets by their name. For example:

sheet = sheets['Sheet1'] # Get sheet by name

The sheet collection also supports iteration, so you can loop over all the sheets in the collection:

The returned sheet object is an instance of NeptyneSheet which is a subclass of CellRange representing an infinite range in both dimensions.

class NeptyneSheetCollection:
def new_sheet(self, name: str | None = None) -> neptyne_kernel.sheet_api.NeptyneSheet:

Create a new sheet - a name will be generated if not provided.

def delete_sheet(self, name_or_id: str | int) -> None:

Delete a sheet by name_or_id.

def rename_sheet(self, name_or_id: str | int, new_name: str) -> None:

Rename a sheet by name_or_id to new_name.

def sheet_from_dataframe( self, df: pandas.core.frame.DataFrame, sheet_name: str) -> neptyne_kernel.sheet_api.NeptyneSheet:

Create a new sheet from a pandas DataFrame df with the name sheet_name.

def sheet_from_csv( self, path_or_buffer: str, sheet_name: str) -> neptyne_kernel.sheet_api.NeptyneSheet:

Create a new sheet from a CSV file at path_or_buffer with the name sheet_name.

@contextmanager
def use_gsheet(self, spreadsheet_id: str) -> Iterator[NoneType]:

Within this context, all sheet operations will be performed on the Google Sheet with the given spreadsheet_id.

@contextmanager
def use_sheet(self, sheet_name: str) -> Iterator[NoneType]:

Within this context, all sheet operations will be performed on the sheet with the given sheet_name.