copilot4office 0.2
ChatGPT copilot for office files
License: MIT
Requires Python: >=3.6

# copilot4office

`copilot4office` is a robust Python package crafted to facilitate the creation of office files, such as PowerPoint presentations, from response texts generated by chat models like ChatGPT. Leveraging the advanced natural language processing capabilities of ChatGPT, `copilot4office` aims to enhance productivity by enabling the generation of contextual and meaningful content across various office documents.

## Features

<!-- - **Word Integration**: Automatically generate document content, summaries, and reports.
- **Excel Integration**: Create descriptive text for data analysis, generate headers, and automate commentary. -->
- **PowerPoint Integration**: Assist in creating comprehensive presentations with autogenerated text for slides. 

## Installation

`copilot4office` can be easily installed via pip from PyPI:

```bash
pip install copilot4office
```

Alternatively, if you want to install the latest version directly from GitHub:

```bash
pip install git+https://github.com/fslurrehman/copilot4office.git
```
## How it Works?
`copilot4office` makes it easy for you to create slides from Chat Prompts for slides. 
1. You ask ChatGPT or Gemini to create slides for you as per sample slides text provided in `examples\data\in\presentation.txt`. Copy the chat responce using copy button in the ChatGPT Web App and paste it in a plain text file. 
2. Run commands as explained in usage to get your presentation right from the text generated by Chat prompts. 
3. Then, you can refine your slides in powerpoint. 

## Usage
After installation, you can start using `copilot4office` by importing it into your Python script. Here's a basic example of generating text for a PowerPoint slide:
```python
from presentation.presentation_processor import PresentationProcessor  

prsp= PresentationProcessor()
#if you are running python from project root then below shall be the path
#if you are running python from examples folder then path shall be: \data\in\presentation.txt
text =prsp.read_text_from_file(r'examples\data\in\presentation.txt')
jsn = prsp.text_to_json(text)
print(jsn)
#if you are running python from project root then below shall be the path
#if you are running python from examples folder then path shall be: \data\out\presentation.json
r = prsp.save_to_file(jsn, r'examples\data\out\presentation.json')
print(r)

```
Make sure to check `examples\data\in\presentation.txt` which is a sample text file that you will use to create json file for presentation.

Here's example of creating powerpoint pptx from json file:

```python
from presentation.presentation_creator import PresentationCreator


#if you are running python from project root then below shall be the path
#if you are running python from examples folder then path shall be: \data\in\jsn.json
creator = PresentationCreator(r'examples\data\in\jsn.json')
content = creator.load_content_from_json()
if creator.validate_content_data(content):
    #if you are running python from project root then below shall be the path
    #if you are running python from examples folder then path shall be: data\out\output_presentation.pptx
    creator.create_presentation(content, r"examples\data\out\output_presentation.pptx")

```

## Developer Guide

Contributors are welcome to enhance `copilot4office` by adding new features, improving existing ones, or fixing bugs. Here's how to get started:

1. **Clone the Repository**:
   ```bash
   git clone https://github.com/fslurrehman/copilot4office.git
   ```
2. **Set Up a Virtual Environment**:
   ```bash
   python -m venv .venv
   source .venv/bin/activate  # On Windows use `env\Scripts\activate`
   ```
3. **Install Development Dependencies**:
   ```bash
   pip install -r requirements.txt
   ```
4. **Run Tests**:
   Make sure all tests pass to ensure your setup is correct.
   ```bash
   python -m unittest tests.test_presentation_processor
   python -m unittest tests.test_presentation_creator
   ```

## Contributing

To contribute to `copilot4office`, please fork the repository, make your changes, and submit a pull request. For more details, see the `CONTRIBUTING.md` file.

## TODO

- [ ] Add word support.
- [ ] Add excel support.
- [ ] Add ChatGPT API to create text. 

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

If you encounter any problems or have suggestions, please file an issue on the GitHub repository.

---