<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sander Vreeken on Medium]]></title>
        <description><![CDATA[Stories by Sander Vreeken on Medium]]></description>
        <link>https://medium.com/@sandervreeken?source=rss-13184f38f7ed------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*r-RY37dyexMOyZbTX4PptQ.jpeg</url>
            <title>Stories by Sander Vreeken on Medium</title>
            <link>https://medium.com/@sandervreeken?source=rss-13184f38f7ed------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 05:45:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandervreeken/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How-to Import Data From Another Workbook in Excel Using VBA]]></title>
            <link>https://medium.com/geekculture/how-to-import-data-from-another-workbook-in-excel-using-vba-3dc7e3604755?source=rss-13184f38f7ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dc7e3604755</guid>
            <category><![CDATA[excel-tutorial]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[macro]]></category>
            <category><![CDATA[vba]]></category>
            <category><![CDATA[excel]]></category>
            <dc:creator><![CDATA[Sander Vreeken]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 08:33:52 GMT</pubDate>
            <atom:updated>2021-08-20T08:33:52.141Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKplzg-aQ96i_p30-YeYPA.png" /></figure><p>Although launched in 1985, Excel is still extremely popular in most industries and is used by almost every company one way or another. Some functionalities of the application could only be utilised by using VBA, which then makes this older software even more helpful when analysing and manipulating data.</p><p>Often you will find yourself copy-pasting data from other files into a consolidated workbook to further investigate the data from there. This process of copy-pasting data might take an tremendous amount of time. We could use this time to do more important things after we have automated this process using some simple VBA code. Let me explain how!</p><p>For this tutorial we will be importing copyright free weather data of Amsterdam from the past, <a href="https://www.meteoblue.com/en/weather/archive/export/amsterdam_netherlands_2759794">which you can find here.</a> Everyone should be able to follow this guide, even without any programming experience, though any prior coding experience will make certain concepts a lot easier to understand.</p><h3>Developer Tab</h3><p>Before we start writing some code, it is important to enable the functionalities needed. Since I have been writing about VBA quite a bit lately, you could best follow the steps under the subtitle ‘How to Build a Macro with Visual Basic for Applications’ <a href="https://www.freecodecamp.org/news/automate-repetitive-tasks-in-excel-with-vba/">in this article.</a></p><p>After you have enabled the Developer tab in your ribbon, save your workbook as an Excel Macro Enabled Workbook (.xlsm), open the Visual Basic editor and double-click the ThisWorkbook option in the Project Explorer in the left-upper corner.</p><p>This should then open a new pane in the editor where you could start typing some code, as shown in Figure 01.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uKERSN84vYZ6uc8UW4K8KA.png" /><figcaption>Figure 01: Visual Basic</figcaption></figure><h3>Writing VBA Code</h3><p>In the new opened pane we will start writing the code needed to import data from external sources. <br>Type Sub, short for subroutine, enter ImportData as name, conclude with two parentheses and press enter. Your macro should then be automatically completed by the editor, as shown in the code block below, where after we only need to enter the code that should be executed upon running the actual macro in between the two Sub keywords.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f72ebbeafd66a01aed8ecb6d4acc6056/href">https://medium.com/media/f72ebbeafd66a01aed8ecb6d4acc6056/href</a></iframe><p>As discussed, the goal for this tutorial will be to copy paste the data from one sheet to another. In order to import another workbook, there are several mandatory steps, which I will explain thorougly below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d76d806ceb9c2535fd3e888bf9430dc5/href">https://medium.com/media/d76d806ceb9c2535fd3e888bf9430dc5/href</a></iframe><p>Within the earlier defined macro, we start by adding a variable on line two.<br>If you have never coded before, you could imagine a variable as a box to store information. Just like when you would be moving and write down the contents of the box, it is needed to define the name of the variable and its data type. Most used data types are strings (words and sentences), integers (rounded numbers) and doubles (numbers with decimals).</p><blockquote><em>In case you are not sure what data type to use, the Variant type is the way to go. Do not use this type every time, as it will use more memory and therewith slow down your program.</em></blockquote><p>In this case we are declaring a variable (aka preparing a box), so we could store the location of the file later.</p><p>In line four, the GetOpenFile method, which is built-in within Excel, will open a file explorer and return the location of the file you selected. The location, which you might recognise from those paths in the top bar of a regular file explorer, is then saved in our previously declared variable.</p><p>Before we proceed we need to check whether the user actually selected a file. If we would skip this part and no file would have been selected, the program would crash immediately. Because we included a check to see whether something is actually stored in the variable, the program knows what to do in both cases. If the file location variable is null (false), meaning no file is selected, Excel will play the iconic beep sound and exit the macro without too much hassle.</p><p>If there is a file selected, we need all the processing power of the device to handle the files open, which we can do by turning off the ScreenUpdating property. From then, everything on screen in Excel will be paused, while the device uses that power to calculate instead. To be honest, this might not be needed for now, but it is a good practice to get used to before you start building more complex macros where such a property will actually make a difference.</p><p>After we have turned off all the visuals, we will define an object using the Set keyword. To access the data from the workbook, we need to store this workbook as an object. Basically every method and property you would expect on the initial workbook is also available on this object.</p><p>To round off, we close the imported workbook and enable ScreenUpdating again in order to ensure everything looks normal again.</p><p>You could now run this code by pressing the green arrow in Visual Basic while your cursor is somewhere waiting between the two Sub keywords.</p><p>I know. You have selected the document with the weather data after the file explorer window opened, but apart from that, nothing happened. Don’t worry, that is actually correct!<br>Everything we have written now is needed to store the data from the external workbook in the object we called ImportWorkbook.</p><p>Now we will have some fun and make our lives a little easier!</p><p>Before programatically closing the file, you could use the Copy method to copy-paste the data from your imported workbook to the original one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74e422ef4f2c5a8292c3a580043ec51f/href">https://medium.com/media/74e422ef4f2c5a8292c3a580043ec51f/href</a></iframe><p>The block of code above copies cells A1:D25 (cells used in the data file discussed in the beginning of this tutorial) from the first worksheet of the imported workbook.</p><p>This method comes with an optional parameter which you could use to define its pasting location.</p><blockquote><em>Not defining this new location for the data would copy the imported numbers to your clipboard where after you could paste them somewhere yourself instead.</em></blockquote><p>In our case, we would like to paste the data in the upper-left corner (starting from cell A1) of the original file, which is targeted using the ThisWorkbook object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f14cc81d8e2bf611f04c9d5ca9606a44/href">https://medium.com/media/f14cc81d8e2bf611f04c9d5ca9606a44/href</a></iframe><p>If you would now paste this line of code in your already existing subroutine just above where we are closing the file, save &amp; run the macro and import the downloaded data file from Meteoblue, you should see the data pasted in your original file.</p><h3>Alternative Usage</h3><p>As said, the ImportWorkbook includes everything you would expect from a workbook. Meaning that you could also get other information from the imported workbook that might that be needed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d80a44e22fce79b4accaaa093332e93d/href">https://medium.com/media/d80a44e22fce79b4accaaa093332e93d/href</a></iframe><p>Replacing the earlier used code to copy-paste the data from one sheet to another with the two lines above, should print you the name of the imported workbook and the sheet that is currently selected in the Immediate Window in your editor.</p><blockquote><em>If you run the macro and do not see this information printed, select the View dropdown menu in the editor and make sure to select the Immediate Window.</em></blockquote><p>In order to run this macro without the Visual Basic editor open, choose the Macros button in the Developer tab from the ribbon and from there select the macro you wish to run. As an alternative you could choose to select the Button option from the same tab and select the macro, which will create a button in your workbook that executes the macro when you press it.</p><h3>Conclusion</h3><p>Congratulations, you are now able to import data from an external workbook!</p><p>Feel free to experiment with this code, so you are able to use your own data files and please do not forget to leave a bit of applause if you liked this tutorial.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dc7e3604755" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/how-to-import-data-from-another-workbook-in-excel-using-vba-3dc7e3604755">How-to Import Data From Another Workbook in Excel Using VBA</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Logbook For Your Excel Workbook Using Simple VBA Code]]></title>
            <link>https://medium.com/geekculture/create-a-logbook-for-your-excel-workbook-using-simple-vba-code-aa612cd4b3ba?source=rss-13184f38f7ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa612cd4b3ba</guid>
            <category><![CDATA[vba]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[visual-basic-programming]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[visual-basic-excel]]></category>
            <dc:creator><![CDATA[Sander Vreeken]]></dc:creator>
            <pubDate>Wed, 18 Aug 2021 03:03:25 GMT</pubDate>
            <atom:updated>2021-08-18T03:03:25.506Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKplzg-aQ96i_p30-YeYPA.png" /></figure><p><a href="https://www.freecodecamp.org/news/automate-repetitive-tasks-in-excel-with-vba/">After my last story was published on freeCodeCamp two weeks ago,</a> it is time for a new tutorial using the most dreaded programming language of the world again.</p><p>If you are working in a team and have multiple members using the same set of documents, it might become handy to maintain a worksheet that registers the people opening or closing a certain workbook. Although version control might help you a lot already in certain cloud platforms, such as OneDrive, VBA could help you store other information, which might be more relevant to you.</p><p>I would like to keep this explainer as short and easy as possible to show how you could use simple VBA code for the most simple tasks you would not imagine using the language for. To follow this tutorial, I do not expect you to have a any prior experience using VBA or any other programming languages, but it might be easier to understand certain aspects.</p><h3>Preparing Our Workbook</h3><p>We will start by opening a new workbook, renaming the initial worksheet to ‘Logbook’ and defining some headers for our logbook, which are shown in Figure 01.</p><p>In this tutorial, I will show you how to store the date, user and action (whether the workbook has either been closed or opened), but feel free to add your own headers and data at the end of the tutorial with your new superpowers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4Wsj03D7ai2l9FckBv3Ww.png" /><figcaption>Figure 01: Logbook Worksheet</figcaption></figure><h4>Developer Tab</h4><p>Before we will start writing code, it is important to get the Developer tab available in your Excel window. A quick heads-up on how to get these functions available in the ribbon is available in the article linked in the beginning of this article under the subtitle ‘How to Build a Macro with Visual Basic for Applications’.</p><h3>Writing VBA Code</h3><p>Once you have that ready and the Visual Basic editor open, it is time to start writing some code.</p><p>In order to start writing a macro, you will always start with the Sub keyword, which is short for subroutine and defines the beginning of a function. If you then enter a name for your macro, end with two parentheses and press the enter key, the editor will conclude the subroutine with the words ‘End Sub’.</p><p>The macro will only start doing something after we have entered some code within the two Sub keywords, so let’s do that now.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/37f311a41f006d6fef4af73764c443c8/href">https://medium.com/media/37f311a41f006d6fef4af73764c443c8/href</a></iframe><p>First of all, I would like to add another row in our Logbook worksheet above the second row. This might not be needed with the initial log, but will prevent you from overriding the data with later insertions.<br>To do so, we can call the Rows object that live on the Worksheets Object and then call the Insert method, which be default will just add one extra row above the row number specified in the Rows object.</p><p>Now that we have a clear row, we could start adding the actual information. To change the value of a cell, you could directly use the Range object, which takes a cell or multiple cells as a parameter. <br>As the Value property is the default property of the Range object, it is not needed to enter this as well. But for your convenience, please understand that the two lines of code will do exactly the same.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c3f00a4cfe65b8ec360e823e12eabc2/href">https://medium.com/media/7c3f00a4cfe65b8ec360e823e12eabc2/href</a></iframe><p>The Now function is built-in within Excel and will return the current date and time of your device. This timestamp is then used as the value for the next cell in the column. <br>If we would now run this macro, by clicking the green arrow while having the cursor somewhere waiting in your subroutine, you will see the data being inserted in your Logbook worksheet.</p><h3>Adding the Action Data</h3><p>But hey, we also defined an action header before, why do we not use that? Let me explain.<br>At this point a user would have to run the macro manually before the data is actually added to the screen. Though, to prevent people from forgetting this, Excel thought of something clever. They came up with a functions which are automatically executed upon opening and closing the workbook.</p><p>Although they look like regular functions, the two macros below will be executed on opening and closing the workbook, based on their name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3397052fc989d480147434d194715347/href">https://medium.com/media/3397052fc989d480147434d194715347/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c565cbe1aff74570876f9c78e84ef06/href">https://medium.com/media/0c565cbe1aff74570876f9c78e84ef06/href</a></iframe><p>Please note that the latter includes a parameter. Despite that we will not be using it for now, it is important to leave it in as your program will crash without.</p><p>Apart from adding the action by using a hard coded string, not that much has changed to our macro. <br>For the closing macro, we have also added the Save method. This saves the workbook and is a method that lives on the ThisWorkbook object. Though just as with the Value property before, the ThisWorkbook is the default which means there is no need to include that in our code. Leaving out the Save keyword would prompt the user with the question whether they would actually like to save their changes, which we want disregard their preference to track the usage of the workbook.</p><p>If you would now close and re-open the workbook again, two new lines should be inserted with the timestamp, your username and whether you opened or closed the document.</p><h3>Refactor Using a VBA Function</h3><p>The code above should be easy to follow, even if you have never coded before. If you have though, you could argue that we are repeating ourselves quite a bit in both macros.</p><p>Just like in many other programming languages, we could therefore define a function that we could call in our macro. Might we ever want to change something to our macros, we will not need to do that at in several places, but in one only.</p><p>To define a new function, you use the Function rather than the Sub keyword. Name the new defined function to something you like, I am choosing for WriteLog. Might you hit enter again after the parentheses, Excel will finish your function definition with End Function.<br>In between these parentheses, define a parameter called Action with the string datatype. Copy the earlier used code in the function statement and replace the value for cell C2 to the parameter Action.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15b4f764fb5386c683db1faffde0ea0b/href">https://medium.com/media/15b4f764fb5386c683db1faffde0ea0b/href</a></iframe><p>Now we have a function that we could use to insert a new log whereby the action that will be inserted depends on the string we give in as a parameter.</p><p>To give in a parameter when calling a function, you would name the parameter, followed by := and the value you would like to insert.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/899bce937a98e9a5ad5f2259cc762425/href">https://medium.com/media/899bce937a98e9a5ad5f2259cc762425/href</a></iframe><h3>Conclusion</h3><p>The code above will now be enough to insert a new row with the earlier defined information on every closing and opening of the workbook.</p><p>Congratulations, you have now made yourself an automated logbook in Excel using VBA!</p><p>Feel free to experiment with this code to add your own information instead and please do not forget to leave a bit of applause if you liked this tutorial.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa612cd4b3ba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/create-a-logbook-for-your-excel-workbook-using-simple-vba-code-aa612cd4b3ba">Create a Logbook For Your Excel Workbook Using Simple VBA Code</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Location Autocomplete Form Tutorial with Algolia and React]]></title>
            <link>https://medium.com/swlh/location-autocomplete-form-tutorial-with-algolia-and-react-65cabee5d0dd?source=rss-13184f38f7ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/65cabee5d0dd</guid>
            <category><![CDATA[algolia]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[location]]></category>
            <dc:creator><![CDATA[Sander Vreeken]]></dc:creator>
            <pubDate>Thu, 28 May 2020 22:28:22 GMT</pubDate>
            <atom:updated>2020-05-28T22:28:22.947Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGSJ06jRDUDCtoZCfnKnkQ.png" /></figure><p><em>Since it took me a long time before I figured out how to create an input field that would autocomplete a location in React, I thought sharing how I did this would be beneficial to a lot of people trying to do the same.</em></p><p>For this tutorial, I assume you know how to start a basic React project in your terminal. After that, I have removed most of the initially created template, so we are ready to build our own components. I have create the most simple application you could imagine to focus on the autocomplete functionality instead.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/423abd050ca01cfaf9f9ca78789cfded/href">https://medium.com/media/423abd050ca01cfaf9f9ca78789cfded/href</a></iframe><p>As well, I have used very basic CSS using the <a href="http://getbem.com/naming/">BEM naming convention</a>. I have commented the code for you to understand why I used certain properties, but this most-probably is not new for most of you.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8059a06096e063996ba589d521d0256/href">https://medium.com/media/d8059a06096e063996ba589d521d0256/href</a></iframe><p>Now we are ready to implement the autocomplete function within our application. For this functionality, I am using <a href="https://www.algolia.com/">Algolia</a>, which is software that helps to create ‘relevant, scalable, and lightning fast Search and Discovery experiences’. <a href="https://www.algolia.com/doc/guides/building-search-ui/resources/ui-and-ux-patterns/in-depth/places/react/">On their website they have placed a tutorial</a>, which for myself was too limited, for which I will explain the process step-by-step.</p><p>For this to work we need certain npm packages, therefore please make sure to install the following external libraries before continuing this tutorial. <em>If you like this article and would like more tutorials like this, please consider some claps (by pressing the hands on de left), while you are fetching the libraries.</em></p><pre>npm install react-instantsearch-dom places.js</pre><p>Then create a new folder, named algolia, in your src directory to store the code from Algolia, as they mention in their tutorial (took me a long time to get to that folder name, yeah). Thereafter we are ready to create a file named connector.js in which we paste the first code snippet as shown in their tutorial. Do this once more, though now take the snippet under widget and paste this in a to-be new created file called widget.js.</p><p>After you have done this, you almost made yourself a working autocomplete field. From the third (and therewith last) code snippet take the import statement and searchClient constant and paste this in our App.js between the import of our .css file and the declaration of the App function. As we have placed the code within a folder called algolia, you will have to change the source of the Places import. Make sure this is set as displayed below.</p><pre>import Places from ‘../src/algolia/widget’;</pre><p>The last step to have a working autocomplete field is to copy-paste the InstantSearch element (the part from last the code snippet we did not use yet) in the place of our earlier created input field. By doing this, you will see that your autocomplete is working in your favourite browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6i_cGl8_Zym6w3zZKthag.png" /></figure><p>Problem now is that this field does not look like the one we created earlier. To get this right, go to the widget file in your algolia folder and replace the return statement of the Places class render method with the following.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7165c06ba16ee2754000edc4c2055a6e/href">https://medium.com/media/7165c06ba16ee2754000edc4c2055a6e/href</a></iframe><p>We are now using our own created class again and have removed the div which was blocking the input from using the full width available. <br>Though, if you start typing a location, you will see two icons to delete your input, which is not working, nor looking great. To remove one of them, I would recommend to add the following selector in your .css file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/323adc49d014997002b909a09c48f7a0/href">https://medium.com/media/323adc49d014997002b909a09c48f7a0/href</a></iframe><p>To get the actual location the user chooses, Algolia already made a function to make this really easy. In the same widget file as used earlier you will see two autocomplete.on functions, of which one is fired when the input has been changed and the other when the input field is cleared. To log the suggestion the user picks, simply place a console.log method in this function and print event.suggestion, which will print you an object with detailed information of the selected location.</p><p>Use props to pass a function from your App.js file to store the object so you could use this data within your application. For your convenience, you can find my code of this tutorial <a href="https://github.com/SanderVreeken/react-location-autocomplete">here</a>. As well, do not hesitate to <a href="https://twitter.com/SanderVreeken">contact me on Twitter</a> in case you have any questions left.</p><h3>Thanks for reading! Make sure you give this post some claps via the button on the left if you enjoyed this post and want to see more. I publish articles on web development each week. Please consider to leave a comment and follow me here on Medium.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65cabee5d0dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/location-autocomplete-form-tutorial-with-algolia-and-react-65cabee5d0dd">Location Autocomplete Form Tutorial with Algolia and React</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How-to Create and Export Animations with Anima in Sketch]]></title>
            <link>https://medium.com/@sandervreeken/how-to-create-and-export-animations-with-anima-in-sketch-2bf3aa9c9c20?source=rss-13184f38f7ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bf3aa9c9c20</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[sketch]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[plugins]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Sander Vreeken]]></dc:creator>
            <pubDate>Sat, 22 Feb 2020 10:50:09 GMT</pubDate>
            <atom:updated>2020-02-23T08:59:52.213Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*MyRyD2rCEZaYtmBqtYZIRg.gif" /></figure><p>I have been using Sketch for MacOS for multiple years now already, though so far I only created static designs, which would be either for iOS or web applications. The problem with still designs though, is that the idea behind some of the components would not be reflected like I intended them to be, as they were not animated.</p><p>Lately, I found out that there is a way (and most-probably multiple more exist) to bring your designed elements to life within Sketch. In this tutorial, I would like you to show how you are able to simply animate a loading bar with the Anima plugin in Sketch.</p><p>For this you will need both <a href="https://www.sketch.com/">Sketch</a> and <a href="https://www.animaapp.com/">Anima</a>, which you can both download and use for free for a certain period before you will have to pay for their services.</p><p>First, create a regular rectangle in your favourite color, which for me is #77F0BB for today. Then you will have to select your entire artboard, which is the iPhone 8 frame in my case, and click the create button in the Anima plugin tool, which you should normally find on your right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4GdynWVfqsNRBX4jAjxOAQ.png" /></figure><p>Once you are in the Anima tool, it is very easy to create and adjust your animations. The screen is showing all states (starting with two) it will loop over for your animation. As both states will look the same when you start, you will have to change either one of the two in order to see a change in your animation.</p><p>In this example, I will only change the width of the rectangle in the first state to ten pixels, so the animation will change between ten and the original used number (257) of pixels.</p><p>When you would select an element, a lightning icon will appear, which will give you the possibility to choose when to play your animation. This could be either be when clicked, hovered or a time preference. Below the states you create, there is a timeline in which you can set the number of seconds the animation will take to get from the first to second state. In case you would create more than two states, you would also be able to set a delay in this part of the plugin.</p><p>Once everything is set to your liking, you could see your animation, by pressing the ‘run component’ button at the top of the application.<br>The great thing about Anima is that you are able to export this animation in code, video or GIF (like I used at the top of this article). Like this, it it extremely easy to export your code to CodePen and share this with the people who actually will be coding your application.</p><h3>Thanks for reading! Make sure you give this post some claps via the button on the left if you enjoyed this post and want to see more. I publish articles on web development each week. Please consider to leave a comment and follow me here on Medium.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bf3aa9c9c20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How-to Create an Excel File in Node.js with Axios and Excel4Node]]></title>
            <link>https://medium.com/swlh/how-to-create-an-excel-file-in-node-js-with-axios-and-excel4node-9d415c45bee4?source=rss-13184f38f7ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d415c45bee4</guid>
            <category><![CDATA[node-js-tutorial]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[http-request]]></category>
            <dc:creator><![CDATA[Sander Vreeken]]></dc:creator>
            <pubDate>Sun, 05 Jan 2020 12:38:32 GMT</pubDate>
            <atom:updated>2020-02-23T08:58:50.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uErdOX-J6YxfiQNhY7cThA.png" /></figure><p>Most of the time you most-probably want to use the data of an API on your website or in your application. Though, sometimes it might be that you are willing to download the data you got in an easy-to-read Excel (.xlsx) file. Luckily for us, Node is providing this option with the Excel4Node package. Let’s see how this works!</p><p>For this tutorial we will download old weather data, which is as a sample and available without an API key, though please feel free to use your own data if you want to. The data is encoded in JSON and can be found <a href="https://samples.openweathermap.org/data/2.5/forecast/hourly?id=524901&amp;appid=b6907d289e10d714a6e88b30761fae22">here.</a> You might want to create a free account at OpenWeatherMap, so you can get real time data, rather than the older sample data I am using in this tutorial.</p><h3>Downloading the Data via Axios</h3><p>In order to download the data first we will use the Axios library, which is a great promise based HTTP client of which you can find more information <a href="https://github.com/axios/axios">here.</a> To do so, create a new folder, a JavaScript file and install the discussed two packages via your terminal with the code below.</p><pre>npm install axios<br>npm install excel4node</pre><p>After you installed the two libraries, we can start the actual coding. The following code should download the necessary data, so preferably type (in order to learn the syntax), otherwise copy this code in and I will explain you per line what is happening.</p><pre>const axios = require(&quot;axios&quot;);<br>const xl = require(&#39;excel4node&#39;);</pre><pre>const API_SAMPLE_URL = ‘https://samples.openweathermap.org/data/2.5/forecast/hourly?id=524901&amp;appid=b6907d289e10d714a6e88b30761fae22&#39;</pre><pre>const getWeatherData = async () =&gt; {<br>   try {<br>      return await axios.get(API_SAMPLE_URL)<br>   } catch (error) {<br>      console.error(error)<br>   }<br>}</pre><pre>const processWeatherData = async () =&gt; {<br>   const weatherData = await getWeatherData()</pre><pre>   if (weatherData.data) {<br>      let API_RESPONSE = weatherData.data.list<br>      console.log(API_RESPONSE)<br>   }<br>}</pre><pre>processWeatherData()</pre><p>Running this code will give you an array with the weather data of Moscow on the 31st of March 2019 during different moment of the day. Let me explain you how this works.</p><p><strong>Line 1–2<br></strong>Here we are simply including the two packages we downloaded into the project via npm before. Although we will not be using the Excel4Node right away, you will get the point that we will need this later on.</p><p><strong>Line 4<br></strong>This line is declaring a constant containing the URL of where to get the actual data. This is mainly done to prevent any typos in case the project would get larger and we would have to copy the URL in multiple places. Now we can just use this constant and prevent any mistakes made there.</p><p><strong>Line 5–11<br></strong>A regular arrow function with the in ES8 introduced async/await methods included. Within the function there is a try/catch statement, which is ideal for this kind of situations, because in case of any errors, your programme does not break completely, but prints the error in your terminal.<br>In case Axios is able to get the data from the URL provided as parameter in the axios.get method on line seven, the response will be returned, so we can use it later on. Otherwise, the function will run the catch statement and log the error.</p><p><strong>Line 13–20<br></strong>Another arrow function with async/await methods has been placed here. Since the await keyword has been placed here, the code will wait for the JSON data to be downloaded before running any other code. <br>If completed, we check whether the data we want is included. The original response comes with a lot of metadata, which we will not use for this tutorial. Therefore I limit the API_RESPONSE constant to a limited version and print this to the console. This constant is an array with the weather data (all the dictionaries), of which one example (first instance of the array) is shown below.</p><pre>{<br>   dt: 1553709600,<br>   main: {<br>      temp: 272.09,<br>      temp_min: 271.358,<br>      temp_max: 272.09,<br>      pressure: 1018.01,<br>      sea_level: 1018.01,<br>      grnd_level: 997.153,<br>      humidity: 100,<br>      temp_kf: 0.73<br>   },<br>   weather: [{<br>      id: 803,<br>      main: ‘Clouds’,<br>      description: ‘broken clouds’,<br>      icon: ‘04n’<br>   }],<br>   clouds: { all: 60 },<br>   wind: { speed: 3.25, deg: 287.822 },<br>   sys: { pod: ’n’ },<br>   dt_txt: ‘2019–03–27 18:00:00’<br>}</pre><h3>Creating the Excel file with Excel4Node</h3><p>Now we have collected this data and stored it in an array, we can easily create an Excel (.xlsx) file out of this for you to be distributed. <br>In order to so I have only added the bold code below, which helps me to create the Excel file containing the temp value. Despite the fact that I have only included one value for now, feel free to add as many variables in the excel file as you wish.</p><pre>const API_SAMPLE_URL = ‘https://samples.openweathermap.org/data/2.5/forecast/hourly?id=524901&amp;appid=b6907d289e10d714a6e88b30761fae22&#39;</pre><pre>const getWeatherData = async () =&gt; {<br>   try {<br>      return await axios.get(API_SAMPLE_URL)<br>   } catch (error) {<br>      console.error(error)<br>   }<br>}</pre><pre>const processWeatherData = async () =&gt; {<br>   const weatherData = await getWeatherData()</pre><pre>      if (weatherData.data) {<br>         let API_RESPONSE = weatherData.data.list</pre><pre><strong>         var wb = new xl.Workbook();<br>         var ws = wb.addWorksheet(‘Weather Data’);</strong></pre><pre><strong>         var style = wb.createStyle({<br>            font: {<br>               color: ‘#000000’,<br>               size: 10,<br>            }<br>         });</strong></pre><pre><strong>      ws.cell(1, 1)<br>         .string(Object.keys(API_RESPONSE[0].main)[0])<br>         .style(style);</strong></pre><pre><strong>      for (a = 0; a &lt; API_RESPONSE.length; a++) {<br>         ws.cell(a + 2, 1)<br>         .number(API_RESPONSE[a].main.temp)<br>         .style(style);<br>      }</strong></pre><pre><strong>   wb.write(‘WeatherData.xlsx’);</strong><br>   }<br>}</pre><pre>processWeatherData()</pre><p>Let’s discuss the code above per line to see what is happening.</p><p><strong>Line 20–21<br></strong>Just like you would open Excel and open a new workbook, the same is happening here in code. Line 20 is creating a new workbook, extended by line 21, which creates a new worksheet named Weather Data. Note that everything else added to the workbook will be added to either the wb or ws value (depending on what it is), so in the end the wb (short for workbook) can be created.</p><p><strong>Line 23–28<br></strong> The workbook needs to now what the styling of the cells will be. For now, I have only set the font to black and its size to ten, though you could add here whatever you like. Check out all the possibilities over <a href="https://www.npmjs.com/package/excel4node">here.</a></p><p><strong>Line 30–32<br></strong>Here we are starting to fill the cells with the actual data. Above the temperatures, which we will enter right after, I want a title showing the user that these are temperatures. <br>For this I get the API_RESPONSE constant, get the first element, go into the main (which is a key in the dictionary) part, get all the key values and take the first instance (0). Excel4Node has the cell method, which can be used to place the data. In this case I am placing the title temp as a string in cell 1, 1 and use the style we have set before.</p><p><strong>Line 34–38<br></strong>With the help of the for in-range loop we will enter the temperatures below the just entered title. The loop will go over all the temperature data and place the values in the cells, with the cell method and styling used before.</p><p><strong>Line 39<br></strong>This final function is combining all the information we have entered and creating the actual file for you. Without this function nothing would be created or done. With the parameter of this function you can name your file to whatever you like.<br>If you run the code, you should find the Excel file in the same folder as your code.</p><h3>Thanks for reading! Make sure you give this post some claps via the button on the left if you enjoyed this post and want to see more. I publish articles on web development each week. Please consider to leave a comment and follow me here on Medium.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d415c45bee4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/how-to-create-an-excel-file-in-node-js-with-axios-and-excel4node-9d415c45bee4">How-to Create an Excel File in Node.js with Axios and Excel4Node</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Brief Introduction to Web Scraping with Node.js & Puppeteer]]></title>
            <link>https://medium.com/swlh/a-brief-introduction-to-web-scraping-with-node-js-puppeteer-4e0e25d94b6e?source=rss-13184f38f7ed------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e0e25d94b6e</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[puppeteer]]></category>
            <category><![CDATA[web-scraping-tools]]></category>
            <category><![CDATA[scraping]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sander Vreeken]]></dc:creator>
            <pubDate>Wed, 01 Jan 2020 19:09:45 GMT</pubDate>
            <atom:updated>2020-02-23T08:59:15.179Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TRY2XQF6doDYOSBax5-2ig.png" /></figure><p>Recently I wanted to use some data displayed on a website for my own web application. After a bit of research, it became clear that this is doable with the Node.js package Puppeteer. Puppeteer could help you to navigate a page for you, though in this tutorial we will mainly be focussing on the scraping part of this package.</p><p>In this this tutorial we will see how to to scrape the data from an original webpage, which does not offer an (easy-to-use) API.</p><p>For this tutorial I assume you will have at least a basic knowledge of Node.js, though most people should be able to follow the steps below. <br>We will use the webpage displaying the agenda of the Amsterdam ArenA, which recently was renamed to the Johan Cruiff Arena (after the famous soccer player passed away in 2016). In this example, I am going to create an array of dictionaries, whereby per dictionary we will be storing the name, year, month and day of all the events listed on this website.</p><p><a href="https://www.johancruijffarena.nl/calendar.htm">Calendar</a></p><h3><strong>Foundation of Puppeteer</strong></h3><p>First step here would be to create a new folder where we create a new JavaScript file. Via the terminal find your new-created folder and install the Puppeteer package with the line below.</p><pre>npm install --save puppeteer</pre><p>Next will be to open a code editor of your choice and to start writing the code necessary to scrape the data shown on the webpage.</p><pre>const puppeteer = require(‘puppeteer’);</pre><pre>let scrape = async () =&gt; {<br>   const browser = await puppeteer.launch();<br>   const page = await browser.newPage();</pre><pre>   await page.goto(‘https://www.johancruijffarena.nl/calendar.htm&#39;);</pre><pre>   const result = await page.evaluate(() =&gt; {<br>      var data = [];<br>      <br>      var tables = document.querySelectorAll(‘table’);<br>      data = tables.length;</pre><pre>      return data;<br>   }, );</pre><pre>   browser.close();<br>   return result<br>}</pre><pre>scrape().then((value) =&gt; {<br>   console.log(value);<br>});</pre><p>I would encourage you to manually type out the code above to learn the basics syntax of the package and thereafter to run your script file via the terminal.</p><pre>node script.js</pre><p>If your terminal is also providing you with an integer, good job! Let’s discuss what the code and the integer mean before we continue with printing actual data to the console.</p><pre>const puppeteer = require(‘puppeteer’);</pre><p><strong>Line 1<br></strong>Here we are including the downloaded package Puppeteer in the script file and therewith in the project.</p><pre>let scrape = async () =&gt; {<br>   const browser = await puppeteer.launch();<br>   const page = await browser.newPage();</pre><pre>   await page.goto(‘https://www.johancruijffarena.nl/calendar.htm&#39;);</pre><pre>   const result = await page.evaluate(() =&gt; {<br>      var tables = document.querySelectorAll(‘table’);<br>      var data = tables.length;<br>   <br>      return data;<br>   }, );</pre><pre>   browser.close();<br>   return result<br>}</pre><p><strong>Lines 3-20<br></strong>A regular arrow function including the in ES8 introduced async keyword, which will help a lot in further lines when we scrape the data.</p><pre>const browser = await puppeteer.launch();<br>const page = await browser.newPage();</pre><pre>await page.goto(‘https://www.johancruijffarena.nl/calendar.htm&#39;);</pre><p><strong>Lines 4–7<br></strong>From here on we are using the features Puppeteer is providing us. A constant named browser is created in which we open a new page just like you and I would do when we open an internet browser. <br>Then (you see what I did there?) the browser will go the page specified and not continue with the code below this statement before the page has been opened, thanks to the async/await keywords.</p><pre>const result = await page.evaluate(() =&gt; {<br>   var tables = document.querySelectorAll(‘table’);<br>   var data = tables.length;<br>   <br>   return data;<br>}, );</pre><p><strong>Lines 9–16<br></strong>In these lines we are using a function offered by Puppeteer, namely page.evaluate. We are setting this equal to the constant result, so we could use the data we return later on by calling result.<br>The actual scraping (and I think the fun) starts here! We are saving all table elements of the earlier defined website in the tables variable. I assume when you use Node.js, you understand the basics of HTML and JavaScript and therefore this should be doable. The variable named data is then initialised and set to the number of tables collected. This integer is returned and accessible via the result constant.</p><pre>browser.close();<br>return result</pre><p><strong>Line 18–19<br></strong>After the scraping part is done, the browser is closed and the result constant discussed above is returned, so this can be used once the scrape variable (let) is called.</p><pre>scrape().then((value) =&gt; {<br>   console.log(value);<br>});</pre><p><strong>Line 22–24<br></strong>The code on these lines will wait before executing until the scrape function is finished because of the then keyword and the actual integer found in line thirteen will be logged in the terminal.</p><h3>Scraping &amp; Saving Data</h3><p>Now we have discussed the basics of this package, you might wonder, why did he choose to select all the table elements of this website?<br>In my experience with Puppeteer (and web scraping in general) it is easier to take an element which includes all the data you would like to cover, rather than scraping different element containing parts of the total you are searching for. <br>If you would open the website and its Developer Tools (in Chrome), you would see that every table element includes a header with a year and month and a body with a n number of events with weekday, day in the month and a title. Let me show you with the following code how convenient this can be when scraping data.</p><pre>const result = await page.evaluate(() =&gt; {</pre><pre>   var data = [];</pre><pre>   var tables = document.querySelectorAll(‘table’);</pre><pre>   for (a = 0; a &lt; tables.length; a++) {<br>      let monthYear =<br>      tables[a].children[0].children[0].children[0].innerText;</pre><pre>      for (b = 0; b &lt; tables[a].children[1].childElementCount;    <br>         b++) {</pre><pre>            let day =      tables[a].children[1].children[b].children[0].children[0].innerText;</pre><pre>            let title = tables[a].children[1].children[b].children[1].children[0].innerText;</pre><pre>            let event = { title, monthYear, day };<br>            data.push(event);<br>      }<br>   }</pre><pre>   return data;<br>}, );</pre><p>Replace the code above (either copy-paste it in, though preferably type it yourself) with the original page.evaluate function we had earlier. Run your script and see what it logs in your terminal.<br>Great right? Without an API, we are still able to get the data we want by using Puppeteer. Let me guide you through my adjusted code.</p><pre>var data = [];</pre><p>First of all, I have created an empty array, which later will be returned with all the dictionaries including the scraped data.</p><pre>for (a = 0; a &lt; tables.length; a++) {<br>      let monthYear =<br>      tables[a].children[0].children[0].children[0].innerText;</pre><pre>   for (b = 0; b &lt; tables[a].children[1].childElementCount;    <br>      b++) {</pre><pre>      let day =      tables[a].children[1].children[b].children[0].children[0].innerText;</pre><pre>      let title = tables[a].children[1].children[b].children[1].children[0].innerText;</pre><pre>      let event = { title, monthYear, day };<br>      data.push(event);<br>   }<br>}</pre><p>In the code above you will see two nested for in-range loops. The first loop is covering all the tables collected earlier. <br>If you would open your Developer Tools once more, you would see that for every table the year and month text is covered within three elements, a td, a tr, and thead tag. In order to dig to the text we actually want to scrape, you use the children keyword to enter the next layer. The integer you fill in between the brackets then defines what number element you would like to enter (starting at 0, just like with an array) seen from the selected table. After reaching the needed element, the innerText method can get us the text of this element. As the loop will cover every single table element, all tables and therewith all months and years will be covered as shown on the original website.</p><p>In the second for in-range loop we loop over the single events in every month defined. As this is different per month, the childElementCount keyword is used, which helps to define the number of elements within the actual table.<br>Just like we used the children keyword above, the day of the month and title will be saved in a variable. <br>Eventually every single event is then stored in an event dictionary with its title, year, month and day of the month and pushed to the data array.</p><p>As seen before, this data is returned again and thereafter logged to the console in which we find our array with scraped data.<br>Of course, this data might not always look super pretty right away, but with some data manipulation you will be able to present this for whatever purpose you might need it (e.g. your own website).</p><h3>Thanks for reading! Make sure you give this post some claps via the button on the left if you enjoyed this post and want to see more. I publish articles on web development each week. Please consider to leave a comment and follow me here on Medium.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e0e25d94b6e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/a-brief-introduction-to-web-scraping-with-node-js-puppeteer-4e0e25d94b6e">A Brief Introduction to Web Scraping with Node.js &amp; Puppeteer</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>