### Install lsd-cloner CLI Globally Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Installs the Looker Studio Dashboard Cloner CLI tool globally using npm, making the 'lsd-cloner' command available system-wide. ```bash npm install -g lsd-cloner ``` -------------------------------- ### Run Interactive Dashboard Cloner Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Launches the interactive command-line interface for the Looker Studio Dashboard Cloner. It prompts the user for necessary information like GCP project details, dashboard ID, and data source mappings to clone a dashboard. ```bash # Start interactive mode lsd-cloner # Example interactive session output: # ? Detected current GCP project my-project, do you want to use it (Y) or choose another (N)?: Yes # ? Looker Studio dashboard id (00000000-0000-0000-0000-000000000000): 7dc7e6db-1234-5678-9abc-0609b2ab712c # ? Looker Studio dashboard name: Sales Dashboard Copy # ? BigQuery dataset name for source tables: analytics_dataset # ? (0) Enter a datasource alias in Looker Studio dashboard: campaign # ? (0) Enter a BigQuery table id with data for Looker Studio datasource: campaign_data # ? Do you want to enter another datasource (y/N): No # Open the following link in the browser for cloning the dashboard: # https://lookerstudio.google.com/reporting/create?c.mode=edit&c.reportId=7dc7e6db-1234-5678-9abc-0609b2ab712c&... ``` -------------------------------- ### Prompt for Dashboard Data Sources (TypeScript) Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Recursively prompts the user to enter data source aliases and their corresponding BigQuery table IDs for a Looker Studio dashboard. The process continues until the user indicates they have no more data sources to add. The function returns a mapping of these aliases to table IDs. ```typescript async function ask_for_dashboard_datasources( datasources: Record ): Promise> // Interactive prompts: // ? (0) Enter a datasource alias in Looker Studio dashboard: campaign // ? (0) Enter a BigQuery table id with data for Looker Studio datasource: campaign_data // ? Do you want to enter another datasource (y/N): Yes // ? (1) Enter a datasource alias in Looker Studio dashboard: conversions // ? (1) Enter a BigQuery table id with data for Looker Studio datasource: conversions_data // ? Do you want to enter another datasource (y/N): No // Result: // { // "campaign": "campaign_data", // "conversions": "conversions_data" // } ``` -------------------------------- ### Save Answers to a File for Reuse Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Saves the current configuration or user responses to a JSON file. This allows for reusing the same settings for future cloning operations or sharing configurations with team members. ```bash # Save answers to default file (answers.json) lsd-cloner --save # Save answers to a specific file lsd-cloner --save=my-dashboard-config.json # Output: Answers saved into my-dashboard-config.json ``` -------------------------------- ### Non-Interactive Cloner Usage (Bash) Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Demonstrates how to use the Looker Studio Dashboard Cloner in a non-interactive environment, such as an SSH session. The tool reads configuration answers from a JSON file, generates the cloning URL, and outputs it for manual opening in a browser. This enables automated dashboard cloning workflows. ```bash # In an SSH session where browser cannot open automatically lcd-cloner --answers=config.json # Output: # Using answers from 'config.json' file # Open the following link in the browser for cloning the dashboard: # https://lookerstudio.google.com/reporting/create?c.mode=edit&c.reportId=... # Copy the URL and open it in your local browser ``` -------------------------------- ### Format Looker Studio Linking API Cloning URL (TypeScript) Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Constructs a Looker Studio Linking API URL for cloning a dashboard. It takes report details, GCP project information, and a mapping of data source aliases to BigQuery table names as input. The output is a URL that can be used to create a copy of the specified dashboard, with data sources automatically reconfigured. ```typescript function format_linking_api_cloning_url( report_id: string, // Dashboard UUID (e.g., "7dc7e6db-0000-1234-5678-0609b2ab712c") report_name: string, // Name for the cloned dashboard project_id: string, // GCP project ID containing BigQuery tables dataset_id: string, // BigQuery dataset ID datasources: Record // Map of alias -> table name ): string // Example usage: const url = format_linking_api_cloning_url( "7dc7e6db-0000-1234-5678-0609b2ab712c", "Sales Dashboard Copy", "my-gcp-project", "analytics_dataset", { "campaign": "campaign_data", "users": "user_metrics" } ); // Returns: https://lookerstudio.google.com/reporting/create?c.mode=edit&c.reportId=7dc7e6db-0000-1234-5678-0609b2ab712c&r.reportName=Sales%20Dashboard%20Copy&ds.*.refreshFields=false&ds.campaign.connector=bigQuery&ds.campaign.datasourceName=campaign_data&ds.campaign.projectId=my-gcp-project&ds.campaign.datasetId=analytics_dataset&ds.campaign.type=TABLE&ds.campaign.tableId=campaign_data&ds.users.connector=bigQuery&ds.users.datasourceName=user_metrics&ds.users.projectId=my-gcp-project&ds.users.datasetId=analytics_dataset&ds.users.type=TABLE&ds.users.tableId=user_metrics ``` -------------------------------- ### Run Cloner with Pre-populated Answers File Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Executes the Looker Studio Dashboard Cloner using a JSON answers file to bypass interactive prompts. This is useful for automating the cloning process and scripting. ```bash # Run with answers from a JSON file lsd-cloner --answers=answers.json # The tool reads the file and uses pre-populated values # Output: Using answers from 'answers.json' file ``` -------------------------------- ### Looker Studio Linking API URL Format for Cloning Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Illustrates the format of the Looker Studio Linking API URL generated by the cloner tool. This URL is used to clone a dashboard and automatically retarget its BigQuery data sources to specified projects and datasets. ```url https://lookerstudio.google.com/reporting/create? c.mode=edit &c.reportId=7dc7e6db-0000-1234-5678-0609b2ab712c &r.reportName=My%20Dashboard%20Copy &ds.*.refreshFields=false &ds.campaign.connector=bigQuery &ds.campaign.datasourceName=campaign_table &ds.campaign.projectId=my-gcp-project &ds.campaign.datasetId=my_dataset &ds.campaign.type=TABLE &ds.campaign.tableId=campaign_table ``` -------------------------------- ### Answers JSON File Structure Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Defines the structure of the JSON file used to provide pre-populated answers for the Looker Studio Dashboard Cloner. This file contains all necessary configuration to clone a dashboard without interactive prompts. ```json { "use_current_project": false, "project_id": "my-gcp-project", "dashboard_id": "7dc7e6db-0000-1234-5678-0609b2ab712c", "dashboard_name": "My Dashboard Copy", "dashboard_dataset": "my_dataset", "dashboard_datasources": { "campaign": "campaign_table", "conversions": "conversions_table", "users": "users_table" } } ``` -------------------------------- ### Detect GCP Project (TypeScript) Source: https://context7.com/google/looker-studio-dashboard-cloner/llms.txt Detects the current Google Cloud Platform project ID. It first checks if a project ID is provided in the answers. If not, it attempts to detect the current project using the gcloud CLI. If neither is successful, it prompts the user to select a project from a list of available projects, validating the selection. ```typescript async function get_gcp_project(answers: Partial): Promise // Behavior: // 1. If answers.project_id is set, returns it directly // 2. If gcloud CLI is available, detects current project via: // gcloud config get-value project // 3. Prompts user to confirm or select a different project // 4. Lists available projects with autocomplete: // gcloud projects list --format="csv(projectId,name)" --sort-by=projectId --limit=500 // 5. Validates selected project exists: // gcloud projects describe ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.