Using #AppsScript to call an #API from Google Sheets

AppsScript is a Macro programming language that you can use within Google Sheets to automate data entry. In this case, we want to take one cell, which contains a vehicle registration number, and run it through an API, in order to extract details, like the make / model / VIN of that car. The API providing this is available here; (India) – Many other countries are available, like the US, UK, Australia, South Africa, etc., but this particular example is for India.

To Access the App Script “IDE” press Extensions > App-Script on your google sheet. Here I am using the code as follows:


function CheckIndia(plate,property,subproperty)
var userProperties = PropertiesService.getUserProperties();
var cacheHit = userProperties.getProperty(plate);
if (cacheHit != null)
var cacheData = JSON.parse(cacheHit);
if(subproperty == null)
return cacheData[property];
return cacheData[property][subproperty];
// Sample UP14CT0093
var url = ‘’ + plate;
var headers = {
“Authorization” : “Basic ” + Utilities.base64Encode(USERNAME + ‘:’ + PASSWORD)
var params = {
var response = UrlFetchApp.fetch(url,params);
var json = response.getContentText();
var data = JSON.parse(json);
if(subproperty == null)
return data[property];
return data[property][subproperty];

The USERNAME / PASSWORD variables need to be taken from your registration on .

The Function “CheckIndia” is what you call from within the Google Sheet Cell, such as:


Here, in the example above, A2 is the cell that contains the license plate, and “Description” is the make + model of the vehicle.

There is a level of internal caching built-in so that the API is not called every single time a call is made, if the call was made elsewhere on the sheet.

Sharing code between ASP.NET and ASP.NET Core

With the release of .NET 6 there are even more benefits to using ASP.NET Core. But migrating existing code to ASP.NET Core often sounds like a big investment. Today we’ll share how you can accelerate the migration to ASP.NET Core. There are minor changes you can make today that can make it easier to migrate to ASP.NET Core tomorrow.

Before we begin let’s talk about a real scenario. Let’s talk about how to modify code in a 10-year-old application so that it can be shared with ASP.NET Core. In the next sections we’ll give samples that migrate the ShoppingCartController.cs from the MVC Music Store app that was used to demo ASP.NET MVC3.

The first step to migrating this web app is to create a new ASP.NET Core Web App (Model-View-Controller) project. This template will add support for Controllers and map the default route for Controllers in the Program.cs file. Once we have the new project setup, we’ll remove the default HomeController and the view files for Home/Index and Home/Privacy so we can share content from the MVC3 Music Store web app without conflict.

You can share Controllers

The first thing you can share between the two projects is Controllers. Many teams want the new website to work the same as the current one. And when we say “the same” we mean “the same”. If you fix a bug in one project, then you need that same fix to show up in both sites. One of the easiest ways to assure this behavior is to share the same file in both projects. Luckily ASP.NET Core uses the new SDK style project files. That means it’s easy to open the csproj file and add some changes because the files are very readable.

To start sharing a Controller class you’ll need to create an <ItemGroup> and add a reference to the existing class. Here’s a sample that shows how to share the ShoppingCartController.cs by updating the csproj file of the ASP.NET Core project.

<Compile Include=”..MvcMusicStoreControllersShoppingCartController.cs” LinkBase=”Controllers” />

Okay, now the file is included in the project but you may have guessed that the ASP.NET Core project doesn’t compile anymore. In ASP.NET Core the Controller class doesn’t use System.Web.Mvc it uses Microsoft.AspNetCore.Mvc.

Here’s a sample that shows how the ShoppingCartController.cs can use both namespaces to fix that compiler error.

#if NET
using Microsoft.AspNetCore.Mvc;
using System.Web.Mvc;

There are other places in the ShoppingCartController that would need to be updated but the approach is the same. Using C# preprocessor directives we can make the class flexible enough to compile for both projects.

For scenarios with large sections of code that work differently for ASP.NET Core you may want to create implementation specific files. A good approach is to create a partial class and extract those code blocks to new method(s) that are different between the two web app targets and use the csproj to control which files are included when building the project.

You can share Models

Now that we can share Controllers we’ll want to share the Models they return. In many scenarios this will just start working when we include them by adding another <ItemGroup> to the csproj file. But if your models also reference System.Web then we can use the same approach we just used for Controllers. Start by updating the namespaces so that the same class file can exist in both projects. Keep using the C# precompiler directives to add ASP.NET Core support.

Here’s a sample that shows how to modify the [Bind] attribute.

#if !NET
public partial class Order
#if NET
publicintOrderId{ get; set; }

You can share Views

We can even share views. Using the same approach again we can edit the csproj file to share files like the _Layout.cshtml. And, inside the view you can keep using C# precompiler directives to make the file flexible enough to be used by both projects.

Here’s what it looks like to have a master page with mixed support for Child Actions from ASP.NET and View Components from ASP.NET Core so that we can render the part of the page that knows how many items are in the shopping cart.

#if NET
@Html.RenderAction(“CartSummary”, “ShoppingCart”);

Wrapping up

The ability to share code also includes static content like CSS, JavaScript and images. Step-by-step you can build flexibility into your web app today to make your migration to ASP.NET Core easier.

If you would like more detailed guidance to migrate the entire ShoppingCartController.cs you can follow a full walkthrough with samples at MvcMusicStoreMigration. The walkthrough will also demonstrate how you can run both ASP.NET and ASP.NET Core from the same IIS Application Pool to incrementally migrate your web app one controller at a time.

For those planning to start work on their ASP.NET Core migration we’ll share a few more tips.

Upgrade your NuGet packages so you can use netstandard.
Change your class libraries to netstandard so you can share code between ASP.NET and ASP.NET Core.
Find references to System.Web in your class libraries build interfaces replace them. Use dependency injection so you can easily switch between ASP.NET and ASP.NET Core features.

You can also find more guidance from our docs at Migrate from ASP.NET to ASP.NET Core.

The post Sharing code between ASP.NET and ASP.NET Core appeared first on .NET Blog.

What is Angular


Angular is a client-side open-source JavaScript-based front-end framework, which is used to build custom applications in HTML, CSS and Typescript. AngularJS was launched in 2009 by Misko Hevery and Adam Abrons as a project at Google.  It is a front-end JavaScript framework, which was developed to build web-based dynamic applications easier, due to its MVC (Model-View-Controller) feature. AngularJS is currently supported as a framework, although no longer being developed or updated.

Don’t confuse it with Angular (without JS) which is the term for Angular 2 and above (i.e. versions 2, 4, 5, 6, 7, 8, and now the latest version is 13) which was released in 2016. Angular 2, as it used to be known, demonstrated considerable differences from AngularJS, the main difference of which was its change in the template language.

One of the key features of Angular is that it uses TypeScript as a programming language. Alternatively, it is possible to create Angular applications using languages such as Dart or JavaScript. However, TypeScript is still the primary language. 

Angular has four main types of web app development:

PWAs (Progressive Web Apps)
UI animations
Web and mobile applications
Business web applications

Why use Angular

Angular is a quite popular framework for building web and mobile apps and can be the perfect framework for building large-scale, powerful and easy-to-serve web apps. So here is the list of reasons why you should use Angular:

Safety. Angular is a fairly trustworthy platform because it is supported by Google

Reduced development time. Angular relies on the current JavaScript virtual machine by transforming templates into code. Angular’s load time is also fast. 

Unit test friendly. Angular features two-way data binding of modules and components, which makes the code consistent and easy to understand for unit testing. Every unit of code is independently tested across the entire app building process, providing in-depth quality control.

Cross-platform. Angular-based PWAs can run on a variety of platforms, and the framework is widely used in native mobile apps. Previously, frontend developers used a cross-platform combo of Ionic with Angular. Nowadays, its most popular combo is with NativeScript.

Complex learning curve. Angular uses a much harder learning curve than other frameworks. To get started, you need to explore all aspects of the framework, such as RxJS (a reactive library for asynchronous development) and Typescript (used to increase maintainability and code support capabilities), not just basic JavaScript. 

Community. Angular has a great community and ecosystem which is actively supported. There is plenty of content on the framework like guides and videos, and lots of useful third-party tools as well.

With all the advantages of Angular, it is not a universal solution for absolutely every task, and that’s okay. Every technology is well suited to solve specific issues, and for some other tasks, other approaches will be more reasonable. It’s easy to use Angular to create a project, but it’s harder to understand if this solution is really good or if it’s worth using.

Who uses Angular

Let’s take a look at the list of cutting-edge companies that use Angular in their modern web application development pipeline:

Microsoft Xbox
Deutsche Bank
The Guardian

How to create your Angular application using the Flatlogic Platform

There are two ways to build your application on the Flatlogic Platform: one-page application only with the frontend or the CRUD application with frontend, backend, database.  

Creating the CRUD application with Flatlogic

1 Step. Choosing the Tech Stack

Firstly, you should set the name of your application and choose the stack: Frontend, Backend, and Database.

2 Step. Choosing the Starter Template

Next, you’re choosing the design of your web application.

3 Step. Schema Editor

In this step you will need to know which application you want to build, that is, CRM or E-commerce, also in this part you build a database schema i.e. tables and relationships between them.

If you are not familiar with database design and it is difficult for you to understand what tables are, we have prepared several ready-made example schemas of real-world apps that you can build your app upon modification:

E-commerce app;
Time tracking app;
Books store;
Chat (messaging) app;

Finally, you can make deployment of your application and in a few minutes, you will get a fully functional CMS for your Angular Application.

Creating a one-page application with Flatlogic 

You can create a frontend-only app with the Flatlogic Platform. This assumes you host the backend somewhere else or do not need it at all. To generate a one-page application you don’t need to enter anything in the terminal of your IDE, you just need to go to the page of creating an application on the Flatlogic website and make only 2 steps:

1 Step. Choosing the Tech Stack

In this step, you set the name of your application and choose the stack: Frontend as Angular, Backend as No-Backend.

2 Step. Choosing the Starter Template

In this step, you choose the design of the web app. Since this is a standard one-page application created using the CLI framework, it will have the design of a standard one-page Angular CLI application.

The final step is to deploy your app and in a few minutes, you will get a one-page Angular application, which you can further modify as you like.

Suggested articles:

What is React
What is PHP
What is Laravel

The post What is Angular appeared first on Flatlogic Blog.