# Sort PNG Files based on last 4 digits in chronological, ascending order and extract data into Google Sheets

**URL:** <https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351>\
**Category:** Questions\
**Tags:** arrays, google-drive, google-sheets\
**Created:** [July 16, 2024, 3:02pm UTC](https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351 "2024-07-16T15:02:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_Weiss](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Alexander\_Weiss](https://community.make.com/u/Alexander_Weiss)\
**Post date:** [July 16, 2024, 3:02pm UTC](https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351/1 "2024-07-16T15:02:19Z")

</div>

Hey guys,

I am trying to automate a process which extracts data from a PNG pictures (e.g. date, IG Name etc.) and insert the data into a Google Sheets document (for each picture a designated row). Of crucial importance in this process is the right sequence in chronological, ascending order of the pictures taken from Google Drive (i.e., IMG\_3252, IMG\_3253, IMG\_3254 etc.) to be inserted into the Google sheets.

However, when conducting the task Make is mixing up the sequence (e.g. 1. IMG\_3252, 2. IMG\_3254, 3. IMG\_3253) and I cannot find a solution how to automatically sort the pictures in the right sequence and afterwards insert it into a Google Sheets document. I´ve tried solutions from comparable problems using parsenumber functions and others in the community but doesn´t seem to work…

The sequence should be based on the last 4 digits of the File name and in ascending order.

Can you help me how to sort out the right sequence, bundle the data once again and then transform it into actual rows in Google Sheets?

Thanks so much in advance!

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/b/d/bdd7ec1febb474cd921c8726e66e14ccc1d68bd9.png)  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/5/25b4e3c369560d05cb6192c74c123acd8b363482.png)

---

<div class="post-metadata">

**Author:** ![Alexander\_Weiss](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Alexander\_Weiss](https://community.make.com/u/Alexander_Weiss)\
**Post date:** [July 16, 2024, 3:12pm UTC](https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351/2 "2024-07-16T15:12:14Z")

</div>

In addition, I am searching for a non paid solution, i.e. no JavaScript Codes etc.

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [July 16, 2024, 3:39pm UTC](https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351/3 "2024-07-16T15:39:02Z")

</div>

Welcome to the Make community!

Error 1: Your array aggregator source module should be the Search module, not the download module.

Error 2: The third parameter of the sort function must be manually typed in, not selected from the variables panel.

[samliew](https://samliew.com/services) – [request private consultation](https://samliew.com/request-quote?ServiceType=Automation%20Consultation&Referrer=Make)

> Join the unofficial [Make Discord server](https://samliew.com/make-discord-invite) to chat with us!

---

<div class="post-metadata">

**Author:** ![Alexander\_Weiss](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Alexander\_Weiss](https://community.make.com/u/Alexander_Weiss)\
**Post date:** [July 16, 2024, 3:48pm UTC](https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351/4 "2024-07-16T15:48:52Z")

</div>

Awesome @samliew that worked, thanks a lot! Following through with my solution, now I run an error when it comes to using my ChatGPT module.

Beforehand, I could select the option “Google Drive - Download a file”, which is now replaced by a “Map” only option.

Can you help me how to proceed once I have the right sequence of the PNG files and how to extract my data now?

Before:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/d/4/d48fbd92d2e1d40ed7929339d347c57447a15938.png)  
After:  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/5/8/581274c5fcd677e81295866ec7e8baa748ccb828.png)

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [July 16, 2024, 4:14pm UTC](https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351/5 "2024-07-16T16:14:16Z")

</div>

You probably need a second pair of Iterator-Aggregator so that you can map an array of images into the images field.

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

[Aggregators](https://www.make.com/en/help/modules/aggregator.html) are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the [Array aggregator](https://www.make.com/en/help/tools/flow-control.html#array-aggregator) module.

# Read this

The Array Aggregator module also allows you to **build a complex array of collections for a later module’s field** to map multiple items (collections) to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

 ![Screenshot_2024-01-17_100113](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/b/e/bea4ecffec9daf39ca9cba77c0b2a40d160e7292.png)

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

[samliew](https://samliew.com/services) – [request private consultation](https://samliew.com/request-quote?ServiceType=Automation%20Consultation&Referrer=Make)

> Join the unofficial [Make Discord server](https://samliew.com/make-discord-invite) to chat with us!

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [October 14, 2024, 4:23pm UTC](https://community.make.com/t/sort-png-files-based-on-last-4-digits-in-chronological-ascending-order-and-extract-data-into-google-sheets/46351/6 "2024-10-14T16:23:28Z")

</div>


