Posts

Showing posts from August, 2022

Google Data Studio Tips & Tricks

 1) Google Data Studio: Refreshing data of uploaded CSV file Ans:  a) If you are uploading the CSV from your local computer, Data Studio will not get updated with any changes you made later in the CSV. b) You can use Google Sheets to store your data, instead of Upload a CSV file as the data source, you can import the data from Google Sheets to Data Studio. c) Any updates on the Google Sheets will be refreshed on Data Studio after you click the Data Refresh button or wait for the default data updates which are 15 minutes.

Google Sheets Useful Codes

 function GetAllSheetsName_1() {   const ss=SpreadsheetApp.getActiveSpreadsheet();   const shts=ss.getSheets();   shts.forEach((sht,index)=>{         //index is optional here     Logger.log(sht.getName() + " " + index)   }) } function GetAllSheetsName_2() {   const ss=SpreadsheetApp.getActiveSpreadsheet();   const shts=ss.getSheets();   Logger.log(shts.length)      for (let i=0;i<shts.length;i++){     Logger.log(shts[i].getName())   } } function GetDataRng(){   const ss=SpreadsheetApp.getActiveSpreadsheet();   const sht=ss.getSheetByName('Sheet4');   const dRng=sht.getDataRange();   Logger.log(dRng.getA1Notation()); } function GetRangeValues(){   const ss=SpreadsheetApp.getActiveSpreadsheet();   const sht=ss.getSheetByName('Sheet1');   //const data=sht.getDataRange(); //works like vba sheet1.usedrange.address   //sheet1.usedrange.address ...

Auto Create Pivot Table & Chart, Auto Refresh Pivot Table

 Auto Create Pivot Table Option Explicit Sub CreatePivotCache_N_PivotTable() ThisWorkbook.Activate Dim pc As PivotCache Dim pt As PivotTable Set pc = ThisWorkbook.PivotCaches.Create( _ SourceType:=xlDatabase, _ SourceData:=Sheet1.Range("A1").CurrentRegion, _ Version:=8) Set pt = pc.CreatePivotTable(TableDestination:=Sheet4.Range("A5"), _ TableName:="MyFirstPivotTable") 'Add Pivot Fields Sheet4.PivotTables("MyFirstPivotTable").PivotFields("State").Orientation = xlRowField Sheet4.PivotTables("MyFirstPivotTable").PivotFields("Region").Orientation = xlRowField Sheet4.PivotTables("MyFirstPivotTable").PivotFields("Region").Position = 1 Sheet4.PivotTables("MyFirstPivotTable").PivotFields("InsuredValue").Orientation = xlDataField Sheet4.PivotTables("MyFirstPivotTable").PivotFields("Sum of InsuredValue").Function = xlSum Sheet4.PivotTables("MyFirstPivotTable...