Tag Archives: developer

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.

3 Techniques that Minimize Downtime


Since users keep on expecting a stable and reliable service, many web developers and system admin attempt to create infrastructures that are more reliable and able to minimize downtime. In fact, minimizing downtime is necessary for increasing customer satisfaction and decreasing support request. Below, we provide you with three areas that are crucial when it comes to downtime and we also offer some improvements that you can apply on them. Check this out!

  1. Monitoring and Alerts

Nothing works better than properly monitoring your infrastructure. In this way, you can discover any issues before they really appear and affect your customers.  Furthermore, monitoring infrastructure will also aggregate and retain a record of stats such as application performance metrics, and system resource utilization. So, the main purpose is to look for anything weird.

Usually a client is interacted on each host that collects metrics for monitoring, and then reports back to a central server. These metrics will be stored in a database and available for many services like searching, alerting, and graphing. Fortunately, there is software that can help you monitor your infrastructure, such as:

  • Graphite

Graphite provides an API that has the support of dozens of applications and programming languages.  On the other hand, metrics are pushed, stored, and graphed in the central Graphite installation.

  • Prometheus

To pull data from a variety of community supported and official clients, you can use Prometheus. It has an alerting system that is built-in and is highly scale able. Besides, it comes with client libraries for several programming languages.

  1. Software Deployment Improvement

Believe it or not, software deployment strategies are one area that plays an important role on your downtime. Unfortunately, many people often overlook it.

Bear in mind that having a complex deployment process will result in the production environment leaving the development environment behind. This can cause any risky software releases since every deployment is a much larger set of changes that naturally brings a much higher risk of problem arising. No wonder this process can easily lead to numerous bugs that can slow down development and cause the unavailability of resources.

Therefore, the best solution for this situation is to set up some up-front planning. In order to sync your production environment with your development environment, you have to figure out a strategy that allows you to automate the workflow, code integration, deployment, and testing.

Here are some best practices regarding the continuous integration and delivery (CI/CD) and testing the software that help you start automating deployments:

  • Maintaining a Single Repository

To make sure that every person on the development team works on the same code and can test their changes easily, you can maintain a single repository.

  • Automating Testing and Build Processes

Don’t forget to automate your development and testing as this will simplify deployment in an environment similar to the final use-case. Besides, you will find it helpful, especially when debugging platform-specific issues.

  1. Implementing High Availability

Another strategy that you can apply to minimize downtime is to use the concept of high availability on the infrastructure which includes principles used in designing resilient and redundant systems.

In this case, the system should be able to detect and analyze the health of the system; it has to know precisely where the error is located. Furthermore, the system must be able to redirect traffic as this can help minimize downtime through reducing interruption.

In order to upgrade to a highly available infrastructure, you have to move to multiple web servers and a load balancer from a single server. The load balancer will show you regular health checks on web servers and routes traffic from those servers that are failing.

Moreover, you can also add resilience and redundancy to increase database resilience using database replication; surely, you will find different database models on different configurations of replication. However, many believe that group replication is the most interesting one, as you can read and write operations on a redundant cluster of servers. In this way, you can detect any failing servers and routing done to prevent downtime.

In conclusion, there are three areas that can lead you to less downtime. If you truly put attention on them, you will have happier clients and of course this will lead you to more revenue.

8 Brilliant Tips for Developing the Applications for Internet of Things

Important Tips for Developing the Application for the Internet of Things_YWF

Before we go deeper with IoT, it is imperative to understand what Internet of Things (IoT) actually is. Basically, a platform enables the network, the smart device and user to get connected with the internet via a definite identifier. In general, IoT works on an embedded technology to communicate with all external environments. No wonder this thing has been seen as one of the revolutionary mobile app development trends in this generation, as it can manage everything right from an array of cohesive events to number of interconnected devices.

In fact, many have predicted that 2 billion devices will get connected to IOT by 2020, whereas the next five years $6 trillion is expected to be invested in IoT. This shows that Internet of Things have influenced a diverse set of industries to speak of, including the healthcare sector, the entertainment and gaming, automotive, home automation, and logistics. This is why IoT has a great potential in the future.

The Three Pillars of IoT

There are three major pillars which are important to note, regarding to the entire structure of the Internet of Things, such as:

  • Network: Generally network will perform similar function like router does in connecting the network to device. In this case, the devices are linked to the cloud. The infrastructure stationed at data centers will receive information. The things provide the data stream and also manage it. On the other hand, software helps to organize the things.
  • The things in themselves: it acts as Internet Gateway which is regarded as an Internet Gateway that helps other device communication through a single or many protocols. In fact, you won’t see a screen once the device gets connected to the network.
  • The cloud: it is a server that primarily aims for securing users confidential data. So, when users meet a critical juncture, the data will still get processed whereas the processing of a program usually happens during the concluding stages.

Tips for Developing Applications for IoT

Now, you have a better understanding about IoT and you may have lots of apps for the Internet of Things in mind. However, before you create one, you may want to know some factors that you can use as consideration, such as:

  1. Choose an Appropriate and Convenient Platform

The first step that every developer should do is to select the appropriate platform for the development process. One thing for sure, the platform should support the IoT applications and its components. Some platforms that are IoT proven and offer the scope to design the best in class apps are Ubidots, Xively or Thingworx. With the help of these platforms, you don’t have to start anything from the beginning.

  1. Consider the Industry for IoT Application

As stated above that Internet of Things has much widened and extended services, but there are still some fields that aren’t connected with Internet of Things. Therefore, you have to discover set of industries that can optimally connected such as healthcare, transportation, energy resources, sports, manufacturing etc. For instance, with IoT application, people can easily find transportation such as connecting buses or trains.

  1. Segregate Services from API Interface

Bear in mind that you need to separate the services from API interface while you are developing the apps for IoT. This will ensure you to have an app that runs smoothly on mobile and web desktop. You will surely get better opportunity once you manage your IoT applications well.

  1. IoT Data must be Secured Strongly

Every application developer knows about how important a strong secured environment is, especially to IoT data from the physical attacks. In fact, the security becomes more important when it comes to building GPS networks or banking apps.

  1. The Different Levels of IoT Apps

In order to understand the system and function of IoT applications, you have to know the various levels of IoT applications. Basically, there are four different layers; the devices, the ingestion tier, the analytics area and the end-user.

First of all, you have to consider the devices that you will be connecting. Then, you will see the infrastructure or the software receives data or organizes it. The next layer is all about data which actually is mainly processed with the help of analytics area. The last layer is about the end users for whom the app is getting developed.

  1. Keep an Eye on IoT Device Firmware Security

The difference between the Internet of Things from the traditional web and mobile apps is its hardware which is always apprehended to have security based issues in the firmware this is why it is essential to stay authenticated and signed before the update.

  1. Do not Neglect with Speed and Quality

You cannot comprise with the speed and quality at any cost when creating application for the IoT. Therefore, you have to focus on transforming the ideas into practice and provide stable working prototype.

  1. Ensure Scalability to the Application

It is important to build scalable applications since IoT is still a new concept. However, many believe that IoT is going to get bigger than ever with the time to arrive. In fact, having a good scalability will allow your app to remain in light for a long period of time.

In conclusion

Internet of Things is still considered as new comer in the technological area, but we will immediately see it is expanding and reached to a different height. This will surely help people access information easily and get connected one to each other at a  low price. On the other hand, it is also a challenge for the developers as it is different from other conventional methods.