> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keyflow.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Write to Google Sheets

### **Overview:**

The `Write to Google Sheets` block automates the process of adding data to a Google Sheets file. It supports writing data to both new and existing Google Sheets, providing various options for specifying where and how the data should be added.

<Note>
  To run this block, you will first need to authenticate your Google account
  with Keyflow. Navigate to your
  [credentials](https://keyflow.space/settings/credentials) page and connect
  your Google Sheets using "Read & Write Google Sheets".
</Note>

***

### Inputs & Outputs

| I/O    | Feature                     | Type    | Simple Explanation                                                                                                                            |
| ------ | --------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| input  | `data`                      | any\[]  | The data that you want to write into the Google Sheet.                                                                                        |
| input  | `use_existing_google_sheet` | boolean | If true, writes data into an existing worksheet; if false, creates a new worksheet.                                                           |
| input  | `sheet_link_or_id`          | string  | The link or ID of the pre-existing sheet in Google Drive (only applicable when using an existing sheet).                                      |
| input  | `sheet_name`                | string  | The specific name of the sheet within your spreadsheet where the data will be recorded.                                                       |
| input  | `writer_mode`               | string  | Determines how the entries are inserted: can be set as `Add New Row`, `Add New Column`, `Add to Specified Row`, or `Add to Specified Column`. |
| input  | `row_index`                 | number  | The index of the row when adding data to a specified row, starting from 0. Only used when `writer_mode` is set to "Specified Row"             |
| input  | `column_index`              | number  | The index of the column when adding data to a specified column, starting from 0. Only used when `writer_mode` is set to "Specified Column"    |
| output | `sheet_link`                | string  | The link to the Google Sheet where the data was written.                                                                                      |

***

### Writer Modes

The "Writer Modes" parameter in the Write to Google Sheets block allows you to specify how you want your entries written down in sheets.

1. **Add New Row**: Appends provided data as a new row at the end of a specified sheet.
2. **Add New Column**: Inserts each element from provided data lists sequentially into cells downwards within a newly created column.
3. **Add to Specified Row**: Enables targeting a particular row index for appending provided information directly there—replacing existing content if necessary.
4. **Add to Specified Column**: Similar functionality for columns; overwrites values in a selected column with supplied list contents.

***

### Use Cases

Consider these real-world applications where this block may prove beneficial:

* **Automate Data Entry:** Streamlining frequent reports—like weekly sales numbers—as they get populated directly into designated spreadsheets without manual involvement.

* **Dynamic Reporting:** Creating moments-based reporting structures by generating new sheets regularly or updating current ones according precisely correct approaches defined through parameters.

* **Data Organization:** Collecting survey results or any accumulated user feedback effectively turns chaotic mind dumps into well-partitioned repository tables that afford meaningful analysis insights later on.

* **Real-Time Data Sharing:** Experimenting over tools like applications yielding statistics can allow results updates auto-pushed back onto shared drives fostering collaboration team-wide effortlessly nurtured through this automated process instead spending hours on tidying records by hand!

In summary, whenever there's a requirement tap complex datasets into manageable formats electronically writable onto widespread platforms like GSheets? Look no further than leveraging these blocks!
