সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
BigQuery পরিষেবা আপনাকে Apps স্ক্রিপ্টে Google BigQuery API ব্যবহার করতে দেয়। এই API ব্যবহারকারীদের তাদের BigQuery প্রকল্পগুলি পরিচালনা করার, নতুন ডেটা আপলোড করার এবং প্রশ্নগুলি চালানোর ক্ষমতা দেয়৷
রেফারেন্স
এই পরিষেবা সম্পর্কে বিস্তারিত তথ্যের জন্য, BigQuery API-এর রেফারেন্স ডকুমেন্টেশন দেখুন। Apps স্ক্রিপ্টের সমস্ত উন্নত পরিষেবাগুলির মতো, BigQuery পরিষেবাটি পাবলিক API হিসাবে একই বস্তু, পদ্ধতি এবং প্যারামিটার ব্যবহার করে৷ আরও তথ্যের জন্য, দেখুন কিভাবে পদ্ধতি স্বাক্ষর নির্ধারণ করা হয় ।
/** * Runs a BigQuery query and logs the results in a spreadsheet. */functionrunQuery(){// Replace this value with the project ID listed in the Google// Cloud Platform project.constprojectId='XXXXXXXX';constrequest={// TODO (developer) - Replace query with yoursquery:'SELECTrefresh_dateASDay,termASTop_Term,rank ' +'FROM`bigquery-public-data.google_trends.top_terms` ' +'WHERErank=1 ' +'ANDrefresh_date>=DATE_SUB(CURRENT_DATE(),INTERVAL2WEEK) ' +'GROUPBYDay,Top_Term,rank ' +'ORDERBYDayDESC;',useLegacySql:false};letqueryResults=BigQuery.Jobs.query(request,projectId);constjobId=queryResults.jobReference.jobId;// Check on status of the Query Job.letsleepTimeMs=500;while(!queryResults.jobComplete){Utilities.sleep(sleepTimeMs);sleepTimeMs*=2;queryResults=BigQuery.Jobs.getQueryResults(projectId,jobId);}// Get all the rows of results.letrows=queryResults.rows;while(queryResults.pageToken){queryResults=BigQuery.Jobs.getQueryResults(projectId,jobId,{pageToken:queryResults.pageToken});rows=rows.concat(queryResults.rows);}if(!rows){console.log('Norowsreturned.');return;}constspreadsheet=SpreadsheetApp.create('BigQueryResults');constsheet=spreadsheet.getActiveSheet();// Append the headers.constheaders=queryResults.schema.fields.map(function(field){returnfield.name;});sheet.appendRow(headers);// Append the results.constdata=newArray(rows.length);for(leti=0;i < rows.length;i++){constcols=rows[i].f;data[i]=newArray(cols.length);for(letj=0;j < cols.length;j++){data[i][j]=cols[j].v;}}sheet.getRange(2,1,rows.length,headers.length).setValues(data);console.log('Resultsspreadsheetcreated:%s',spreadsheet.getUrl());}
CSV ডেটা লোড করুন
এই নমুনাটি একটি নতুন টেবিল তৈরি করে এবং এটিতে Google ড্রাইভ থেকে একটি CSV ফাইল লোড করে৷
/** * Loads a CSV into BigQuery */functionloadCsv(){// Replace this value with the project ID listed in the Google// Cloud Platform project.constprojectId='XXXXXXXX';// Create a dataset in the BigQuery UI (https://bigquery.cloud.google.com)// and enter its ID below.constdatasetId='YYYYYYYY';// Sample CSV file of Google Trends data conforming to the schema below.// https://docs.google.com/file/d/0BwzA1Orbvy5WMXFLaTR1Z1p2UDg/editconstcsvFileId='0BwzA1Orbvy5WMXFLaTR1Z1p2UDg';// Create the table.consttableId='pets_'+newDate().getTime();lettable={tableReference:{projectId:projectId,datasetId:datasetId,tableId:tableId},schema:{fields:[{name:'week',type:'STRING'},{name:'cat',type:'INTEGER'},{name:'dog',type:'INTEGER'},{name:'bird',type:'INTEGER'}]}};try{table=BigQuery.Tables.insert(table,projectId,datasetId);console.log('Tablecreated:%s',table.id);}catch(err){console.log('unabletocreatetable');}// Load CSV data from Drive and convert to the correct format for upload.constfile=DriveApp.getFileById(csvFileId);constdata=file.getBlob().setContentType('application/octet-stream');// Create the data upload job.constjob={configuration:{load:{destinationTable:{projectId:projectId,datasetId:datasetId,tableId:tableId},skipLeadingRows:1}}};try{constjobResult=BigQuery.Jobs.insert(job,projectId,data);console.log(`Loadjobstarted.Status:${jobResult.status.state}`);}catch(err){console.log('unabletoinsertjob');}}
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-01-15 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["The BigQuery service in Apps Script enables management of BigQuery projects, data uploads, and query execution using the Google BigQuery API."],["This advanced service requires prior enabling before use and leverages the same structure as the public API."],["Sample code is provided demonstrating how to run a query to retrieve Google Search terms and load CSV data into BigQuery."],["Users can consult the Google Cloud support guide for troubleshooting and support related to the BigQuery service."]]],[]]