This is a command-line application that allows users to interact with Google Sheets. Users can perform various actions such as loading data from sheets, creating new sheets, adding data, updating data, renaming sheets, deleting sheets, and deleting data from specific ranges.
- Go programming language installed on your system.
- Google Cloud Console account with Google Sheets API enabled.
- Service account credentials JSON file.
- A Google Sheets spreadsheet ID.
- Create a service account in the Google Cloud Console.
- Enable the Google Sheets API for the created project.
- Create a service account and download the JSON credentials file.
- Save the JSON credentials file as
credentials.jsonin the project directory.
- Create a
.envfile in the project directory. - Add the following environment variables to the
.envfile:
SPREAD_SHEET_ID=<Your Spreadsheet ID>
Replace <Your Spreadsheet ID> with the ID of the Google Sheets spreadsheet you want to access.
- Clone the repository:
git clone <repository-url>
cd googlesheetscli
- Install Dependencies:
go mod tidy
- Build the Application:
go build ./cmd/app/main.go
- Run the Application:
./main
- Select the load option and choose between loading entire sheet data or specific sheet range.
- Select the create option and provide a name for the new sheet.
- Select the add option, provide the sheet name, column letter, and pressure data to add to the sheet.
- Select the update option, provide the sheet name, cell range, and new pressure data to update the data.
- Select the update option and choose rename. Provide the current sheet name and the new name for the sheet.
- Select the delete option and choose sheet. Choose the sheet you want to delete.
- Select the delete option and choose data. Provide the sheet name and cell range to delete data.
- Select the exit option to quit the program.
Note: Ensure you have the necessary permissions and access to the Google Sheets spreadsheet specified in the SPREAD_SHEET_ID environment variable.