Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tairasu/replace-from-sheets

A simple Rust tool to replace words in a text file from any Google Spreadsheet
https://github.com/tairasu/replace-from-sheets

google-sheets replace-text rust

Last synced: 4 days ago
JSON representation

A simple Rust tool to replace words in a text file from any Google Spreadsheet

Awesome Lists containing this project

README

        

# replace-from-sheets
A simple Rust tool to replace words in a text file from any Google Spreadsheet.
It takes two columns in a Google Spreadsheet and uses them to replace words in any text file.

First column: check which word should be replaced.

Second column: replacing word

| Column A | Column B |
| ------------- | ------------- |
| Aple | Apple |
| Starwbery | Strawberry |

Words on the same line will get replaced.

**Having 2 or more words in a cell works too, but both cells need to have the same amount of words**

## How to use

Inside the src folder there is a init.json file which needs to be edited to your own spreadsheet ID, your desired columns and your own API.

Then navigate to the folder path in your terminal and type ```replace-from-sheets FILENAME.txt```
The text file you want to edit needs to be in the same folder.

### Prerequisites

To build yourself you only need Rust. All Cargo dependencies will be downloaded on building.

Get your own Google Spreadsheet API or any other Google API from any account. It doesn't matter which account you use. The API is only used to read the columns.

**Example init.json**
```
{
"spreadsheet_id": "1234567",
"column1": "Sheet1!A1:A",
"column2": "Sheet1!B1:B",
"api_key": "123abc123abc"
}
```

### Building

Navigate to the root folder and enter
```
cargo build --release
```