A Python utility for searching company information in Salesforce and exporting results to CSV files.
- Search companies by name (partial or exact match)
- Enter company names directly or load from a CSV file
- View account details and related contacts
- Export results to CSV files for further analysis
- Multi-language character normalization support
- Python 3.6+
- Salesforce account with API access
- Connected App set up in Salesforce with OAuth credentials
- Clone this repository:
git clone https://github.com/yuuki00682200/salesforce-company-search.git
cd salesforce-company-search- Install required packages:
pip install -r requirements.txtThere are three ways to provide your Salesforce credentials:
- Environment variables:
export SALESFORCE_USERNAME="[email protected]"
export SALESFORCE_PASSWORD="your-password"
export SALESFORCE_CLIENT_ID="your-client-id"
export SALESFORCE_CLIENT_SECRET="your-client-secret"- Config file:
Create a file named
config.iniin the project directory with the following content:
[Salesforce]
username = [email protected]
password = your-password
client_id = your-client-id
client_secret = your-client-secret- Interactive prompt: If credentials are not found in environment variables or config file, the program will prompt you to enter them.
Run the script:
python3 main.pyFollow the interactive prompts to:
- Enter your Salesforce credentials (if not configured)
- Select search mode (partial or exact match)
- Choose input method (direct input or CSV file)
- Enter company names or CSV file path
- View search results
- Export results to CSV files
When loading company names from a CSV file, the program expects each company name in the first column. The file can have a header row.
The tool generates two CSV files:
salesforce_companies_TIMESTAMP.csv: Contains basic company informationsalesforce_contacts_TIMESTAMP.csv: Contains company information with related contacts
- Never commit your Salesforce credentials to version control
- Use environment variables or a config file that is excluded from version control
- Consider using Salesforce's IP restrictions for API access
This project is licensed under the MIT License - see the LICENSE file for details.
Salesforceの企業情報を検索し、結果をCSVファイルにエクスポートするPythonユーティリティです。
- 会社名での検索(部分一致または完全一致)
- 会社名の直接入力またはCSVファイルからの読み込み
- 取引先の詳細と関連する取引先責任者の表示
- 結果のCSVファイルへのエクスポート
- 多言語文字正規化サポート
- Python 3.6以上
- API アクセス権を持つSalesforceアカウント
- OAuthクレデンシャルを設定したSalesforceの接続アプリケーション
- このリポジトリをクローンします:
git clone https://github.com/yuuki00682200/salesforce-company-search.git
cd salesforce-company-search- 必要なパッケージをインストールします:
pip install -r requirements.txtSalesforceの認証情報を提供する方法は3つあります:
- 環境変数:
export SALESFORCE_USERNAME="[email protected]"
export SALESFORCE_PASSWORD="your-password"
export SALESFORCE_CLIENT_ID="your-client-id"
export SALESFORCE_CLIENT_SECRET="your-client-secret"- 設定ファイル:
プロジェクトディレクトリに
config.iniという名前のファイルを作成し、以下の内容を記述します:
[Salesforce]
username = [email protected]
password = your-password
client_id = your-client-id
client_secret = your-client-secret- 対話式プロンプト: 環境変数または設定ファイルに認証情報が見つからない場合、プログラムは入力を求めます。
スクリプトを実行します:
python3 main.py対話式プロンプトに従って操作します:
- Salesforceの認証情報を入力(設定されていない場合)
- 検索モードを選択(部分一致または完全一致)
- 入力方法を選択(直接入力またはCSVファイル)
- 会社名またはCSVファイルのパスを入力
- 検索結果を確認
- 結果をCSVファイルにエクスポート
会社名をCSVファイルから読み込む場合、プログラムは各会社名が最初の列にあることを想定しています。ファイルにはヘッダー行があっても構いません。
このツールは2つのCSVファイルを生成します:
salesforce_companies_TIMESTAMP.csv: 基本的な会社情報を含みますsalesforce_contacts_TIMESTAMP.csv: 関連する取引先責任者を含む会社情報を含みます
- Salesforceの認証情報をバージョン管理システムにコミットしないでください
- バージョン管理から除外された環境変数または設定ファイルを使用してください
- SalesforceのAPI アクセスにはIP制限の使用を検討してください
このプロジェクトはMITライセンスの下で公開されています - 詳細はLICENSEファイルをご覧ください。