Skip to content

Releases: iperka/scan-categorizer

v2.0.3 ⚡️

01 Mar 12:45
5e6ed88
Compare
Choose a tag to compare

We're thrilled to announce the release of Scan Categorizer Script v2.0, packed with enhanced date detection capabilities and improved functionality! This update introduces a significant improvement where the script not only relies on the creation date but also intelligently scans the filenames for date strings matching the specified format.

What's New:

  • Advanced Date Detection: The script now leverages sophisticated algorithms to parse date strings from filenames, matching the given date format. This allows for more accurate date detection, ensuring precise categorization based on file names.
  • Enhanced Functionality: With the improved date detection mechanism, all other functions within the script now seamlessly utilize the detected date from filenames, ensuring consistency and reliability in categorization tasks.

How It Works:

  1. Date Parsing from Filenames: The script intelligently scans filenames for date strings matching the specified format, prioritizing them over creation dates for categorization purposes.
  2. Flexible Date Formats: You can customize the date format to match your specific naming conventions, ensuring compatibility with a wide range of file naming schemes.
  3. Improved Categorization Accuracy: By considering date information from filenames, the script ensures more accurate categorization, even in scenarios where creation dates might not reflect the actual file content date.

Get Involved:

Your feedback is invaluable in shaping the future development of the Scan Categorizer Script. If you encounter any issues, have suggestions for improvements, or wish to contribute, please don't hesitate to open an issue or submit a pull request on our GitHub repository.

We're committed to continually enhancing the functionality and usability of the script, and we look forward to hearing your thoughts on this latest release!

Happy categorizing! 🚀

Full Changelog: v2.0.2...v2.0.3

v2.0.2 🎈

28 Jun 10:15
f4603b5
Compare
Choose a tag to compare

New Features

You can now rename documents based on their contents by extracting the text property.
Example:

const category = {
  name: "Foo",
  conditions: [sc.and("Foo", "Bar")],
  path: "Foo/Bar/$y",
  rename: function (document) {
    // Deconstruct object 🚧
    const { text } = document;
    const year = new Date().getFullYear();
    if (text.includes("Foo")) {
      return `Fooo_${year}.pdf`;
    } else {
      return `Baaaar_${year}\.pdf`;
    }
  },
};

What's Changed

Full Changelog: v2.0.1...v2.0.2

v2.0.1 🎈

10 May 14:38
Compare
Choose a tag to compare

clasp

Scan Categorizer v2 🗃

Script that organizes all PDF files and moves, renames and creates shortcuts dynamically according to predefined categories and file contents. This script can easily be implemented in your current workflows and saves time navigating through Google Drive and enforces directory structures.

Currently, there are two types of conditions that can be applied to each category:

  • or conditions, which require the document to include one of the words defined.
  • and conditions, which require the document to include all the words defined.

The conditions can also be chained and multiple conditions of different types can be applied to one category.

// Don't worry, there is no coding skills required. Just use the UI to generate conditions!
const conditions = [
  {name: 'Lorem', conditions: [and('lorem', 'ipsum')], path: 'Lorem/$y'},
  {name: 'Ipsum', conditions: [or('ipsum', 'dolor')], path: 'Ipsum/$y'},
  {
    name: 'Ipsum',
    conditions: [or('ipsum', 'dolor'), and('lorem', 'ipsum')],
    path: 'Ipsum/$y',
  },
];

Table of contents 📚

Getting Started 🚀

Follow the 7 simple steps in the Installation guide and start configuring your categories. You can even add your code and customize it even more.

Installation 👾

Step 1 - Create new Script

Create a new Google Script Project within your Google Account. (If App Script is not enabled for your account ask your administrator or switch the account.) When created the project should open an editor.

Step 2 - Add library

In the sidebar menu, click the plus icon on the left-hand side of Libraries.

Screenshot

  • Insert 1489WTMiopg0jt53nfftMhbrHyuF67ieIKOoN2ZCuLLUYNRynw6u6GFS2 as script ID.
  • Select your version. (In most cases, choose the latest version.)
  • Import the library with the name sc.

Step 3 - Configure

Insert the contents from category UI into your Code.gs file.
When running the script you get should asked for permission. Grant the required permissions and test the script.

It's recommended to test your configuration before creating a Trigger.

Possible use cases 🔥

  • Finally, go digital by scanning and automatically organizing your old papers.
  • Enforce directory structures.
  • Automatically distribute incoming mail.
  • Create shortcuts for each invoice for your taxes.

Migrate 🚧

Thanks for using version 1 already, you're awesome! There are several changes in version 2 that will affect your current configurations.

  • $S argument has been deprecated and can no longer be used.
  • There is no more notification email when documents can't get categorized.
  • When using custom rename functions the addShortcut has also been deprecated.
  • The keywords property has been replaced by conditions.
v1 Syntax v2 Syntax
{
  name: "Lorem",
  keywords: ["Lorem", "Ipsum"],
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  conditions: [or("Lorem", "Ipsum")],
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  keywords: ["Lorem", "Ipsum"],
  shortcuts: ["Ipsum/$y"]
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  conditions: [or("Lorem", "Ipsum")],
  shortcuts: ["Ipsum/$y"] // Still the same
  path: "Lorem/$y/$m",
}

We're sorry if you ran into problems. Please open an Issue if you need help.

Development 🦺

The repository uses Typescript and transpires and pushes the code to the corresponding Google App Script.

Clone the repository and install the dependencies with yarn install.
Keep in mind that by default, every function is hidden by using the namespace technique described by clasp docs. To export a function to the users, simply define a wrapper function inside the index.ts file (See existing for guidance).

Authors 💻

Contributing 🤝

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate and meet the quality gate requirements.

Full Changelog: v1.8.1...v2.0.1

Scan Categorizer v2.0.0-beta 🔎

29 Mar 07:38
ffb5528
Compare
Choose a tag to compare
Pre-release

Script that organizes all PDF files and moves, renames and creates shortcuts dynamically according to predefined categories and file contents. This script can easily be implemented in your current workflows and saves time navigating through Google Drive and enforces directory structures.

Currently, there are two types of conditions that can be applied to each category:

  • or conditions, which require the document to include one of the words defined.
  • and conditions, which require the document to include all the words defined.

The conditions can also be chained and multiple conditions of different types can be applied to one category.

// Don't worry, there is no coding skills required. Just use the UI to generate conditions!
const conditions = [
  {name: 'Lorem', conditions: [and('lorem', 'ipsum')], path: 'Lorem/$y'},
  {name: 'Ipsum', conditions: [or('ipsum', 'dolor')], path: 'Ipsum/$y'},
  {
    name: 'Ipsum',
    conditions: [or('ipsum', 'dolor'), and('lorem', 'ipsum')],
    path: 'Ipsum/$y',
  },
];

Getting Started 🚀

Follow the 7 simple steps in the Installation guide and start configuring your categories. You can even add your code and customize it even more.

Installation 👾

Step 1 - Create new Script

Create a new Google Script Project within your Google Account. (If App Script is not enabled for your account ask your administrator or switch the account.) When created the project should open an editor.

Step 2 - Add library

In the sidebar menu, click the plus icon on the left-hand side of Libraries.

Screenshot

  • Insert 1489WTMiopg0jt53nfftMhbrHyuF67ieIKOoN2ZCuLLUYNRynw6u6GFS2 as script ID.
  • Select your version. (In most cases, choose the latest version.)
  • Import the library with the name sc.

Step 3 - Configure

Insert the contents from category UI into your Code.gs file.
When running the script you get should asked for permission. Grant the required permissions and test the script.

It's recommended to test your configuration before creating a Trigger.

Possible use cases 🔥

  • Finally, go digital by scanning and automatically organizing your old papers.
  • Enforce directory structures.
  • Automatically distribute incoming mail.
  • Create shortcuts for each invoice for your taxes.

Migrate 🚧

Thanks for using version 1 already, you're awesome! There are several changes in version 2 that will affect your current configurations.

  • $S argument has been deprecated and can no longer be used.
  • There is no more notification email when documents can't get categorized.
  • When using custom rename functions the addShortcut has also been deprecated.
  • The keywords property has been replaced by conditions.
v1 Syntax v2 Syntax
{
  name: "Lorem",
  keywords: ["Lorem", "Ipsum"],
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  conditions: [or("Lorem", "Ipsum")],
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  keywords: ["Lorem", "Ipsum"],
  shortcuts: ["Ipsum/$y"]
  path: "Lorem/$y/$m",
}
{
  name: "Lorem",
  conditions: [or("Lorem", "Ipsum")],
  shortcuts: ["Ipsum/$y"] // Still the same
  path: "Lorem/$y/$m",
}

We're sorry if you ran into problems. Please open an Issue if you need help.

Scan Categorizer v1.8.1 🏸

22 Sep 11:43
6846202
Compare
Choose a tag to compare

Google Script for better scan workflow. This script allows you to categorize scanned documents with predefined categories and organize your Drive.
The script uses OCR to check if any of the given keywords are included in the document, and if only one category is matched it will organize according to configuration.

Scan and forget!

Changes in v1.8.1

  • Added shortcuts feature to your custom rename function! 🎈
  • Small Bug Fixes 🐞

Scan Categorizer v1.7.1 🏸

26 Aug 15:16
ac362f7
Compare
Choose a tag to compare

Google Script for better scan workflow. This script allows you to categorize scanned documents with predefined categories and organize your Drive.
The script uses OCR to check if any of the given keywords are included in the document, and if only one category is matched it will organize according to configuration.

Scan and forget!

Changes in v1.7.1

  • Added shortcuts feature! 🎈

NEW FEATURE - SHORTCUTS

Since the version 1.7.1 you can define shortcut paths. This works like the category path property, but has to be inside an array. Every path defined inside the shortcuts array will create a link to the file. (You can use the same variables as in the path property.)

Potential use case: Taxes require some documents like salary statements. You can categorize them as salary statements and keep track of them in their folder, but create a link inside your taxes folder.

const CATEGORIES = [
  {
    name: "Foo Bar",
    keywords: ["foo", "bar"],
    path: "Foo/Bar/$y/$m",
    shortcuts: ["Bar/Foo/$y-$m"], // NEW
    rename: function (document) {
      // File ID
      Logger.log(document.id);

      // Current Filename
      Logger.log(document.name);

      // Text contents
      Logger.log(document.text);

      // Creation date
      Logger.log(document.date);

      // Return new filename
      return "new filename";
    },
  },
];

Scan Categorizer v1.6.2 🏸

09 Jun 12:01
267259b
Compare
Choose a tag to compare

Google Script for better scan workflow. This script allows you to categorize scanned documents with predefined categories and organize your Drive.
The script uses OCR to check if one or more of the given keywords are included in the document and if only one category is matched it will organize according to configuration.

Scan and forget!

Changes in v1.6.2

  • keywords will now only be matched if the whole word matches (case sensitive).
  • if a category includes the $S variable the semester can be count from starting year set by schoolStart property.
  • The report email contains the matched categories and keywords.

Usage 🚀

Be sure to configure the script accordingly before using it.

  • Scan a document with your scanner or favorite scanner app. (SwiftScan is recommend)
  • Upload your PDF document to Google Drive into the defined Scanner folder.
  • Manually or automatically trigger script and all the documents will get categorized and organized.

Authors 👨‍💻

License 📃

MIT

Scan Categorizer v1.2.2 🏸

07 Jun 14:18
6fd8ba0
Compare
Choose a tag to compare

Google Script for better scan workflow. This script allows you to categorize scanned documents with predefined categories and organize your Drive.
The script uses OCR to check if one or more of the given keywords are included in the document and if only one category is matched it will organize according to configuration.

Table of Contents 🧾

Installation 🎈

Create a new Google Script Project within your Google Account. (If App Script is not enabled for your account ask your administrator or switch the account.) When created the project should open an editor. Edit the Code.gs and paste the script you downloaded.

Add the Drive and Gmail services to the project and hit Run. The script should ask for permission. Grant the required permissions and test the script.

It's recommended to test your configuration before creating a Trigger.

Configuration ⚙

Adjust the values to your needs.

SCAN_FOLDER_ID

The script will only handle PDFs inside the given folder. Define your input folder.

const SCAN_FOLDER_ID = "1ZNbdXdDdOd-djdedxd9dod1dLdrdwdFd";

REPORT_EMAIL

Whenever a document can't be categorized due to missing keywords or more than one matched category, you will get notified via email.

const REPORT_EMAIL = "your-email@example.com";

CATEGORIES

This option defines the categories. Every PDF document that includes one or more of the defined keywords will be matched and will apply the category. The rename property is optional and can be used to rename the name of the document as required. The extension must be included and must always return a filename or throw an Error.

const CATEGORIES = [
  {
    name: "Foo Bar",
    keywords: ["foo", "bar"],
    path: "Foo/Bar/$y/$m",
    rename: function (document) {
      // File ID
      Logger.log(document.id);

      // Current Filename
      Logger.log(document.name);

      // Text contents
      Logger.log(document.text);

      // Creation date
      Logger.log(document.date);

      // Return new filename
      return "new filename";
    },
  },
];

Usage 🚀

Be sure to configure the script accordingly before using it.

  • Scan a document with your scanner or favorite scanner app. (SwiftScan recommended)
  • Upload your PDF document to Google Drive into the defined Scanner folder.
  • Manually or automatically trigger script and all the documents will get categorized and organized.

Authors 👨‍💻

License 📃

MIT

Contributing 🤝

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate and meet the quality gate requirements.