(선택사항) 처리 위치를 변경하려면 더보기를 클릭하고 쿼리 설정을 선택합니다. 데이터 위치에서 해당 데이터의 위치를 선택합니다.
실행을 클릭합니다.
결과가 반환되면 결과 저장을 클릭하고 결과를 저장할 형식 또는 위치를 선택합니다.
브라우저의 기본 다운로드 위치로 파일이 다운로드됩니다.
쿼리 결과를 Google Drive에 저장
쿼리 결과를 Google Drive에 저장하는 것은 bq 명령줄 도구나 API에서 지원하지 않습니다.
BigQuery 결과를 Google Drive에 저장하려고 하면 오류가 발생할 수 있습니다. 이 오류는 Drive SDK API가 Google Workspace에 액세스할 수 없기 때문에 발생합니다. 이 문제를 해결하려면 Drive SDK API로 Google Drive에 액세스할 수 있도록 사용자 계정을 설정해야 합니다.
쿼리 결과를 Google Drive에 저장하려면 Google Cloud 콘솔을 사용합니다.
CSV(Google 드라이브) 또는 JSON(Google 드라이브)을 선택합니다. 결과를 Google 드라이브에 저장할 때는 위치를 선택할 수 없습니다. 결과는 항상 루트 '내 드라이브' 위치에 저장됩니다.
결과를 Google 드라이브에 저장하는 데 몇 분 정도 걸릴 수 있습니다. 결과가 저장되면 파일 이름 bq-results-[TIMESTAMP]-[RANDOM_CHARACTERS].[CSV or JSON]이 포함된 대화상자 메시지가 수신됩니다.
대화상자 메시지에서 열기를 클릭하여 파일을 열거나 Google Drive로 이동한 후 내 드라이브를 클릭합니다.
쿼리 결과를 Google Sheets에 저장
결과를 Google Sheets에 저장하는 기능은 bq 명령줄 도구나 API에서 지원되지 않습니다.
Google Sheets에서 BigQuery 결과를 열려고 하면 오류가 발생할 수 있습니다. 이 오류는 Drive SDK API가 Google Workspace에 액세스할 수 없기 때문에 발생합니다. 이 문제를 해결하려면 Drive SDK API로 Google Sheets에 액세스할 수 있도록 사용자 계정을 사용 설정해야 합니다.
쿼리 결과를 Google Sheets에 저장하려면 Google Cloud 콘솔을 사용합니다.
(선택사항) 처리 위치를 변경하려면 더보기를 클릭하고 쿼리 설정을 선택합니다. 데이터 위치에서 해당 데이터의 위치를 선택합니다.
실행을 클릭합니다.
결과가 반환되면 결과 저장을 클릭하고 Google 스프레드시트를 선택합니다.
필요한 경우 메시지를 따라 사용자 계정에 로그인하고 허용을 클릭하여 Google Drive MY Drive 폴더에 데이터를 쓸 수 있는 권한을 BigQuery에 부여합니다.
프롬프트에 따라 진행하면 BigQuery 클라이언트 도구가 사용자 계정에 연결되었음을 확인하는 이메일이 전송됩니다. 이메일에는 개발자가 부여한 권한과 권한 삭제 단계에 대한 정보가 있습니다.
결과가 저장되면 Google Cloud 콘솔의 쿼리 결과 아래에 Saved to Sheets as
"results-20190225-103531. Open과 비슷한 메시지가 표시됩니다. 메시지에 있는 링크를 클릭하여 Google Sheets에서 결과를 보거나 My Drive 폴더로 이동하여 수동으로 파일을 엽니다.
쿼리 결과를 Google Sheets에 저장하면 파일 이름이 results-[DATE]로 시작됩니다. 여기에서 [DATE]는 YYYYMMDD 형식의 오늘 날짜입니다.
파일 내보내기 문제 해결
BigQuery에서 Google Sheets로 데이터를 내보낼 때 시트의 일부 셀이 비어 있을 수 있습니다. 이 문제는 셀에 쓰는 데이터가 Google Sheets 한도인 50,000자를 초과할 때 발생합니다.
이 문제를 해결하려면 GoogleSQL 쿼리에서 문자열 함수를 사용하여 long 데이터가 있는 열을 2개 이상의 열로 분할한 후 결과를 시트에 다시 저장하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-26(UTC)"],[[["\u003cp\u003eQuery results can be saved as a CSV or JSON file directly to your browser's default download location through the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Cloud console allows users to save query results to Google Drive in either CSV or JSON format, with files being stored in the root "My Drive" location.\u003c/p\u003e\n"],["\u003cp\u003eQuery results can also be saved directly to Google Sheets via the Google Cloud console, but requires enabling Drive SDK API access and may require permission prompts.\u003c/p\u003e\n"],["\u003cp\u003eThe bq command-line tool and API do not support downloading or saving query results to a local file, Google Drive, or Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eIf exporting data to Google Sheets results in blank cells, you may need to use string functions to split long data columns in your query to work around Google Sheet's cell character limits.\u003c/p\u003e\n"]]],[],null,["# Export query results to a file\n==============================\n\nThis document describes how to save query results as a file, such as CSV or JSON.\n\nDownload query results to a local file\n--------------------------------------\n\nDownloading query results to a local file is not supported by the bq command-line tool\nor the API.\n\nTo download query results as a CSV or newline-delimited JSON file, use the\nGoogle Cloud console:\n\n1. In the Google Cloud console, open the BigQuery page.\n\n [Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. Click add_box **SQL query**.\n\n3. Enter a valid GoogleSQL query in the **Query editor** text area.\n\n4. Optional: To change the processing location, click **More** and select\n **Query settings** . For **Data location** ,\n choose the [location](/bigquery/docs/locations) of your data.\n\n5. Click **Run**.\n\n6. When the results are returned, click **Save results** and select the\n format or location where you want to save the results.\n\n The file is downloaded to your browser's default download location.\n\nSave query results to Google Drive\n----------------------------------\n\n|\n| **Beta**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nSaving query results to Google Drive is not supported by the bq command-line tool or\nthe API.\n\nYou might get an error when you try to save the BigQuery results\nto Google Drive. This error is due to the Drive SDK API\nbeing unable to access Google Workspace. To resolve the issue,\nyou must enable your user account to\n[access Google Drive](https://support.google.com/a/answer/6105699)\nwith the Drive SDK API.\n\nTo save query results to Google Drive, use the Google Cloud console:\n\n1. In the Google Cloud console, open the BigQuery page.\n\n [Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. Click add_box **SQL query**.\n\n3. Enter a valid GoogleSQL query in the **Query editor** text area.\n\n4. Click **Run**.\n\n5. When the results are returned, click **Save results**.\n\n6. Under **Google Drive** , select **CSV** or **JSON**. When you save\n results to Google Drive, you cannot choose the location. Results are\n always saved to the root \"My Drive\" location.\n\n7. It may take a few minutes to save the results to Google Drive. When\n the results are saved, you receive a dialog message that includes the\n filename ---\n `bq-results-[TIMESTAMP]-[RANDOM_CHARACTERS].[CSV or JSON]`.\n\n\n8. In the dialog message, click **Open** to open the file, or navigate to\n Google Drive and click **My Drive**.\n\nSave query results to Google Sheets\n-----------------------------------\n\nSaving query results to Google Sheets is not supported by the bq command-line tool or\nthe API.\n\nYou might get an error when you try to open the BigQuery results\nfrom Google Sheets. This error is due to the Drive SDK API\nbeing unable to access Google Workspace. To resolve the issue,\nyou must enable your user account to\n[access Google Sheets](https://support.google.com/a/answer/6105699)\nwith the Drive SDK API.\n\nTo save query results to Google Sheets, use the Google Cloud console:\n\n1. In the Google Cloud console, open the BigQuery page.\n\n [Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. Click add_box **SQL query**.\n\n3. Enter a valid GoogleSQL query in the **Query editor** text area.\n\n4. Optional: To change the processing location, click **More** and select\n **Query settings** . For **Data location** ,\n choose the [location](/bigquery/docs/locations) of your data.\n\n5. Click **Run**.\n\n6. When the results are returned, click the **Save results** and select\n **Google Sheets**.\n\n7. If necessary, follow the prompts to log into your user account and\n click **Allow** to give BigQuery permission to write the data\n to your Google Drive `MY Drive` folder.\n\n After following the prompts, you should receive an email confirming that\n BigQuery client tools have been connected to your user\n account. The email contains information on the permissions you granted\n along with steps to remove the permissions.\n8. When the results are saved, a message similar to the following appears\n below the query results in the Google Cloud console: `Saved to Sheets as\n \"results-20190225-103531. Open`. Click the link in the message to view your\n results in Google Sheets, or navigate to your `My Drive` folder and open the\n file manually.\n\n When you save query results to Google Sheets, the filename begins with\n `results-[DATE]` where `[DATE]` is today's date in the format\n `YYYYMMDD`.\n | **Note:** Saving results to Google Sheets is not supported by the bq command-line tool or the API. For more information, see [Using Connected Sheets](/bigquery/docs/connected-sheets).\n\n### Troubleshoot saving results to Google Sheets\n\nWhen saving data from BigQuery to Google Sheets, you might\nfind that some cells in the sheets are blank. This happens when the data you\nare writing to the cell exceeds the Google Sheets limit of 50,000 characters.\nTo resolve this, use a\n[string function](/bigquery/docs/reference/standard-sql/string_functions#split)\nin the GoogleSQL query to split the column with the long data into two or more\ncolumns, then save the result to sheets again.\n\nSave query results to Cloud Storage\n-----------------------------------\n\nYou can export your query results to Cloud Storage in the Google Cloud console\nwith the following steps:\n\n1. Open the BigQuery page in the Google Cloud console.\n\n [Go to the BigQuery page](https://console.cloud.google.com/bigquery)\n2. Click add_box **SQL query**.\n\n3. Enter a valid GoogleSQL query in the **Query editor** text area.\n\n4. Click **Run**.\n\n5. When the results are returned, click **Save results** \\\u003e **Cloud Storage**.\n\n6. In the **Export to Google Cloud Storage** dialog:\n\n - For **GCS Location**, browse for the bucket, folder, or file where you want to export the data.\n - For **Export format**, choose the format for your exported data: CSV, JSON (Newline Delimited), Avro, or Parquet.\n - For **Compression** , select a compression format or select `None` for no compression.\n7. Click **Save** to export the query results.\n\nTo check on the progress of the job, expand the **Job history** pane and\nlook for the job with the `EXTRACT` type.\n\nWhat's next\n-----------\n\n- Learn how to programmatically [export a table to a JSON file](/bigquery/docs/samples/bigquery-extract-table-json).\n- Learn about [quotas for export jobs](/bigquery/quotas#export_jobs).\n- Learn about [BigQuery storage pricing](/bigquery/pricing#storage)."]]