<commit_before># Google Apps Script snippets
This is a list of code fragments for the copy / paste tool on yours keyboard. I still don't know what to do about this. It would be great if you had an idea.

## Contents
* [Spreadsheets](#spreadsheets)
  * [Common elements for spreadsheets](#common-elements-for-spreadsheets)
    * [Round to day](#round-to-day)
  * [Values and data](#values-and-data)
    * [Append values to a sheet](#append-values-to-a-sheet)
* [License](#license)

## Spreadsheets

### Common elements for spreadsheets

#### Round to day

```js
// Rounds the date to days. Usefull for timestamps
function roundToDay_(date, offsetOfDays){
  offsetOfDays = offsetOfDays * 24 * 60 * 60 * 1000 || 0;
  var res_ = new Date(date.valueOf() + offsetOfDays);
  res_.setHours(0, 0, 0, 0);
  return res_;
}
```

### Values and data

#### Append values to a sheet
like [appendRow(rowContents)](https://developers.google.com/apps-script/reference/spreadsheet/sheet#appendRow(Object))

```js
// Appends values to sheet
function appendValues(sheet, values, colOffset){
  colOffset = colOffset || 1;
  return sheet.getRange(
      sheet.getLastRow() + 1,
      colOffset,
      values.length, 
      values[0].length
    ).setValues(values);
}
```

## License

[![CC0](http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg)](https://creativecommons.org/publicdomain/zero/1.0/)<commit_msg>TOC generator is added<commit_after><h1>Google Apps Script snippets</h1>
This is a list of code fragments for the copy / paste tool on yours keyboard. I still don't know what to do about this. It would be great if you had an idea.

<h2>Contents</h2>
<!-- TOC -->

- [Spreadsheets](#spreadsheets)
  - [Common elements for spreadsheets](#common-elements-for-spreadsheets)
    - [Round to day](#round-to-day)
  - [Values and data](#values-and-data)
    - [Append values to a sheet](#append-values-to-a-sheet)
- [License](#license)

<!-- /TOC -->

## Spreadsheets

### Common elements for spreadsheets

#### Round to day

```js
// Rounds the date to days. Usefull for timestamps
function roundToDay_(date, offsetOfDays){
  offsetOfDays = offsetOfDays * 24 * 60 * 60 * 1000 || 0;
  var res_ = new Date(date.valueOf() + offsetOfDays);
  res_.setHours(0, 0, 0, 0);
  return res_;
}
```

### Values and data

#### Append values to a sheet
like [appendRow(rowContents)](https://developers.google.com/apps-script/reference/spreadsheet/sheet#appendRow(Object))

```js
// Appends values to sheet
function appendValues(sheet, values, colOffset){
  colOffset = colOffset || 1;
  return sheet.getRange(
      sheet.getLastRow() + 1,
      colOffset,
      values.length, 
      values[0].length
    ).setValues(values);
}
```

## License

[![CC0](http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg)](https://creativecommons.org/publicdomain/zero/1.0/)
{'fraction_non_alphanumeric': 0.14649459365190093, 'fraction_numerical': 0.018835019183815836, 'mean_word_length': 3.9878260869565216, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1107197', 'n_tokens_mistral': 1010, 'n_tokens_neox': 924, 'n_words': 255}