Tag Archives: agency

Ways to Use Google Apps Script to Fetch Databases to a Google Spreadsheet

How to Use Google Apps Script to Fetch Databases to a Google Spreadsheet_YWF

It is pretty common to export information from a WordPress database to an Excel sheet or in a CSV format. However, you may realize that there is a problem with exporting and importing files. One of the most common ones is that the process is sometimes not too intuitive and all files need to be updated at regular intervals.

However, now you can forget those old days, as today, you can solve the problem by using Google Apps Script to link your WordPress database to a Google spreadsheet which automates the workflow. As a web developer, you surely want to know how a Google Apps Script can be used to fetch database values from WordPress through the Google Apps Script Spreadsheet Service. So, here is some information about it that you need to know.

What is Google Apps Script?

Through Google Apps Script, you can automate tasks across Google products and third party services and build web applications. In many cases, Google Apps Script is also known as a JavaScript cloud scripting.

This is why you can do a lot of new things with Google Apps like Docs, Sheets, and Forms through the Google App Script. Other benefits that you can get from the Google App Scripts are:

  • Add custom menus, dialogs, and sidebars to Google Docs, Sheets, and Forms.
  • Write custom functions for Google Sheets
  • Publish web apps – either standalone or embedded in Google Sites
  • Interact with other Google services, including AdSense, Analytics, Calendar, Drive, Gmail, and Maps.

Furthermore, with the Google Apps Script Spreadsheet service, you can create access and modify Google Sheets files.

Creating a Google Apps Script with Spreadsheet

If you want to create a Google Apps Scripts with Spreadsheet, the steps will be as follows:

  • Create a New Spreasheet
  • Click on “Tools ->Script Editor”
  • The editor window will appear in a new tab
  • When writing the script, there are several Classes and methods that you can choose. Some of them are as follows:
  1. Classes
  • BorderStyle
  • DataValidation
  • ContainerInfo
  • Range
  1. Methods
  • getChartType()
  • getRanges()
  • setColours()


Below is the Sample app script example that will store the spreadsheet data into the log:

function logProductInfo() {

var sheet = SpreadsheetApp.getActiveSheet();

var data = sheet.getDataRange().getValues();

for (var i = 0; i < data.length; i++) {

Logger.log(‘Product name: ‘ + data[i][0]);

Logger.log(‘Product number: ‘ + data[i][1]);



  • Don’t forget to debug the script after writing the script. You can debug the icon easily by clicking on debug icon and if debugging is successful with no error then you can “Run” the script by clicking on run icon.
  • Click on “View->Logs” to view the Log.

 Google Apps Script and WordPress

You can also use Google Apps Script with WordPress in many ways. For example, you can connect with the WordPress database. Via JDBC service, Google Apps Script can access many relational databases. It is actually a wrapper around the standard Java Database Connectivity standard. In Google Apps Script, the JDBC service supports the Google Cloud SQL, MySQL, Microsoft SQL Server, and Oracle databases.

You can read the following example that will demonstrate the database connection:

function myFunction() {// make the connectionvar connection = Jdbc.getConnection(“jdbc:mysql://db IP or host name:port number/DB name”, “User name”, “password”);// perform the queryvar SQLstatement = connection.createStatement();var result = SQLstatement.executeQuery(“SELECT * FROM DB_NAME”);// choose a range in sheetvar ss = SpreadsheetApp.getActiveSpreadsheet();var cell = ss.getRange(‘A2’);// loop through result object, setting cell values to database datavar row = 0;while(result.next()) {for(var i=0; i<4; i++) { // four fields per recordcell.offset(row, i).setValue(result.getString(i+1));}row++;}// tidy upresult.close();SQLstatement.close();connection.close();}

By running this code, you will get the values from the database and add the fetched values into the currently active spreadsheet. You can also add values into the database, in which those values can be used in WordPress. For instance, it is possible to register all of the users’ data in a spreadsheet in one go through the Google Apps Script.


In order to easily map your WordPress database to a Google Spreadsheet, you can use the Google Apps Script. Another advantage that you can get by applying this method is that you can simply run this script to update your spreadsheet as per your database. Furthermore, you don’t need to constantly import and merge files in order to keep your online and offline databases in sync. This makes this application highly useful, especially for developers who want to use Google APIs for many purposes.

5 Mistakes Many Smart People Keep Making in SEO

5 SEO Mistakes many Smart People Keep Making_YWF-01

Before starting this article, I would like to remind you that everyone makes mistakes, so whether you have been in this industry for years or a new player, you will likely make mistakes and the only way to minimalize the mistakes is to learn about your mistakes. There will be many SEO mistakes to talk about, but primarily, we want to share some of them with you, so that you can identify and avoid them and then hopefully, it can gain you success faster and more efficiently. If you are a business owner, don’t forget to share this knowledge to your SEO services agency too.

  1. Serving Bots Before Humans

If your SEO efforts are still all about chasing algorithms, or trying to trick search engines, you’d better leave it all behind, since now what it takes to rank well today is exactly the same as what it takes to satisfy visitors.

Unfortunately, many people still think about putting bots above actual humans which can result in ineffective tactics like keyword stuffing, specific content length, and manipulative linking schemes. I understand that this kind of thinking works in the olden days, but in today’s SEO environment, you really need to change your paradigm.

This is because the main priority in SEO is to always focus on your human visitors, since they are the people that will buy and use your products or services. For example, the main idea of creating a mobile-friendly website is to satisfy mobile users with lots of useful, original, and well-written content that can load quickly.

  1. Thinking about Tactics Instead of Strategies

Many people still mislead between tactics and strategies. In fact, this confusion has become a big problem which causes people to be inefficient and aimless. Therefore, it is important to achieve significant long-term success by having a clear understanding of the difference between the two; here are the simple ways to differentiate them:

  • Strategy: A big picture objective that will give you a significant competitive advantage.
  • Tactics: The actions you have to take to achieve that strategy.

For example, when you want to sell things online, you will use social media selling as your strategy, but providing lots of content per day to make people aware of your products is the tactic.

  1. Failing to Accurately Track Performance

It is important to know exactly how you’re performing, so that you can see whether you’re making sufficient progress or not. Furthermore, instead of relying on your gut instinct, you can try to track your performance through so many powerful tools available that can range from Google Analytics and Search Console to paid tools like Raven, SEMrush, and Moz.

With those tools, you can increase what is working and fix or eliminate what isn’t working well in your campaigns. Besides, you can detect any problem early and it will also allow you to correct it early.

  1. Taking Advice from Questionable Sources

With internet, you can easily find a lot of information, but you need to be careful as information that you get from the internet may have been out-dated, or they can be hoax too. On the other hand, SEO has changed dramatically over the last 20 years. This surely makes it is easy for you to find information that is flat-out false. Therefore, you need to stay on top of SEO by reading the top publication from the trustworthy sources. Furthermore, since SEO is a constantly and rapidly evolving industry, you need to keep learning from many reputable sources.

  1. Not identifying Worthwhile Key Performance Indicators

In SEO, there are many things that you can use as your key performance indicator. However, not all things can be used as a good KPI; it depends on the context. For example, if you determine the number of new links on your website as a KPI, then you will call it a win if there are a lot of links coming from one website, and this is not true, as the links can also come from comment spam.

Therefore, your KPI must be objectively measurable and tied to a specific business goal, such as getting in front of ideal prospects, generating positive PR, or generating revenue, such as a link within content that’s relevant to what you do.

By knowing the 5 mistakes that even smartest people often do, you can prevent yourself from doing the same mistakes. Hopefully, after performing good SEO strategies, you can easily run a good SEO performance for growing and improving your business.

SEO Ranking Factors & Correlation: When a Metric is correlated with Google Rankings


In this opportunity we are going to talk about SEO ranking factors and correlation. In the other words, we want to see how correlation can impact on SEO factors. If you have likely seen, over the course of your career in the SEO services, you will see how much SEO works with correlation stuff and how many companies put these out. Actually there are also so many myths about correlation, but aside from that let’s figure out a few smart ways to use and understand the data at hand.

What is correlation good for?

So, what’s correlation actually good for? We know a bunch of myths, but actually that do not work. So, here are some things that correlation is good for.

1. IDing the elements that more successful pages tend to have

When you look across a correlation, you will find lots of pages are twice as likely to have X and rank highly as the ones that don’t rank highly which you can use this finding as a good piece of data.

2. Watching elements over time to see if they rise or lower in correlation

it is important to keep your eyes on links to see if they raise or lower, and then we can say:”Oh, does it look like links are getting more or less influential in Google’s rankings? Are they more or less correlated than they were last year or two years ago?” If the links drop dramatically, you may test the power of links again and it’s the time for you to try another experiment. Then, see if links still move the needle or if they’re becoming less powerful or if it’s merely because the correlation is dropping.”

3. Comparing Sets of search results against one another we can identify unique attributes that might be true

The example above shows that in a vertical like news, we find that domain authority is much more important than it is in fitness; this is where smaller sites potentially have much more opportunity or dominate. Other thing that we can figure out is that https is not too suitable to stand out in news since everybody has it. On the other hand, it works well in fitness as it produces a more stand out result and people who do have it will do it much better or maybe they also invest more in their sites.

4. Judging Metrics as a Predictive Ranking Ability

One question may come up to your mind when you’re looking at a metric like domain authority, such as how good is that at telling me on average how much better one domain will rank in Google versus another? In fact, you can see the number is a good indication of that. When the number goes down, then domain authority is less predictive less sort of useful for me. Conversely, it will be more useful if it goes up. A study is conducted to look at traffic metrics with Alexa Rank and SimilarWeb and which ones are best correlated with actual traffic. The result shows that Alexa Rank is awful while SimilarWeb is better.

5. Finding Elements to Test

You will be amazed to see large images embedded on a page that’s already ranking on page 1 of search results in the first few. This is why we need correlation, especially in SEO when it comes to ranking factors or ranking elements might be misleading.

So, now that you know the area that correlation is good for. However, you still need to be careful as correlation in SEO can be very misleading, especially when it comes to ranking factors or ranking elements. After all, with this explanation, hopefully you can understand how to use and not to use that data.