Конспект по скриптам в google таблицах

Первый скрипт про который я хотел бы рассказать, это создание PDF файла через скрипт, который будет создавать ссылку на PDF файл в котором будет показываться надпись которую вы поставить в таблице.

Выглядит этот скрипт вот таким образом:

//Создается PDF file
function pdf() { 
    // Получаем объект с папкой по её ID
    var folder = DriveApp.getFolderById('1uTQGyiAwoy3l_e7j8gosSBzCiEqFDwfz');
 
    // Создаём новую папку
    // https://drive.google.com/file/d/1eqHYTU8pwvZDDoQiXCBn316lAA31erEM/view?usp=drivesdk
    var folderForPdf = folder.createFolder('kontroll');
 
    // Получаем объект с открытой таблицей
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var ssId = ss.getId(); // ID таблицы
 
    // Получаем объект с файлом открытой таблицы
    var fileSheet = DriveApp.getFileById(ssId);
 
    // Создаём PDF файл и сохраняем его в новой папке
    var pdfBlob = fileSheet.getBlob().getAs('application/pdf');
    var pdfFile = folderForPdf.createFile(pdfBlob);
 
    // Получаем URL, созданного файла
    var pdfFileUrl = pdfFile.getUrl();
    Logger.log(pdfFileUrl);
 }

Для начала заходим в диск

После нажимаем создать папку и называем как хотим

Заходим в созданную папку и копируем часть ссылки в поисковой строке

Далее вставляем эту ссылку в это место

(‘1uTQGyiAwoy3l_e7j8gosSBzCiEqFDwfz’); 

Название созданной папки вставляем в это место

(‘kontroll’)

В принципе это все, осталось только запустить наш скрип и проверять его.

А выглядеть он должен вот так

Мы копируем ссылку что появилась в журнале и вставляем в поисковую строку

Также не забудьте написать или сделать некую таблицу чтобы в нашем файле что либо было.

Если вы сделали все правильно, то вас должно было перенести на сайт с готовым PDF файлом.

На этом первый скрипт закончен, давайте перейдем ко второму.

А второй скрипт будет открывать сайдбар в вашей таблице, с любой надписью какой только вы захотите. Сам скрипт не такой большой и вполне простой.

// Открытие сайдбара
function showSidebar() {
 
  var htmlOutput = HtmlService
    .createHtmlOutput('<p>Tallinna Tööstushariduskeskuses on võimalik õppida eesti kui vene keeles. Põhihariduse baasil õppima asudes  on võimalik omandada kutsekeskharidus 3 aastaga. Keskhariduse baasil on võimalus õppida erialadel päevases kui ka kaugõppes. Kutseharidus omandatakse 0.5-2 aastaga.</p>')
    .setTitle('TTHK');
 
  SpreadsheetApp.getUi().showSidebar(htmlOutput);
 
}

SetTitle – будет отображаться как название, а ниже будет идти сам текст который напишите.

Запускаем скрипт и получаем вот такой результат:

На этом конспект пока что закончен.

Introduce Yourself (Example Post)

This is an example post, originally published as part of Blogging University. Enroll in one of our ten programs, and start your blog right.

You’re going to publish a post today. Don’t worry about how your blog looks. Don’t worry if you haven’t given it a name yet, or you’re feeling overwhelmed. Just click the “New Post” button, and tell us why you’re here.

Why do this?

  • Because it gives new readers context. What are you about? Why should they read your blog?
  • Because it will help you focus you own ideas about your blog and what you’d like to do with it.

The post can be short or long, a personal intro to your life or a bloggy mission statement, a manifesto for the future or a simple outline of your the types of things you hope to publish.

To help you get started, here are a few questions:

  • Why are you blogging publicly, rather than keeping a personal journal?
  • What topics do you think you’ll write about?
  • Who would you love to connect with via your blog?
  • If you blog successfully throughout the next year, what would you hope to have accomplished?

You’re not locked into any of this; one of the wonderful things about blogs is how they constantly evolve as we learn, grow, and interact with one another — but it’s good to know where and why you started, and articulating your goals may just give you a few other post ideas.

Can’t think how to get started? Just write the first thing that pops into your head. Anne Lamott, author of a book on writing we love, says that you need to give yourself permission to write a “crappy first draft”. Anne makes a great point — just start writing, and worry about editing it later.

When you’re ready to publish, give your post three to five tags that describe your blog’s focus — writing, photography, fiction, parenting, food, cars, movies, sports, whatever. These tags will help others who care about your topics find you in the Reader. Make sure one of the tags is “zerotohero,” so other new bloggers can find you, too.

Create your own website, free on WordPress.com.Create your own website.
Start free