Skip to content

Instantly share code, notes, and snippets.

void importInventory()
{
//get contents of the remote CSV file
csv = getUrl("http://yourserver.com/ftp.php");
//create a list and add each row of the csv file into a new list item
line_list = csv.toList("\n");
//empty Products table if today's csv has data.
if (line_list.size() > 0)
void importInventory()
{
//get contents of the remote CSV file
csv = getUrl("http://yourserver.com/ftp.php");
//show raw data for debugging purposes
info csv;
}
Product ID Product Quantity Unit Price Last Updated
123 Some Product 1 12 4.99 15-04-13
124 Some Product 2 22 18 15-04-14
125 Some Product 3 7 23.5 15-04-15
126 Some Product 4 655 2.75 15-04-16
127 Some Product 5 0 19 15-04-17
<?php
//ftp server information
//change values to reflect you server settings
$ftp_server = "ftp.yoursite.com";
$ftp_username = "username";
$ftp_password = "password";
$server_file = "/path_to_csv_file/inventory.csv";
$local_file = "inventory.csv";
@shabdar
shabdar / gist:7624346
Created November 24, 2013 07:20
A Windows command line script written in JavaScript for bulk exporting Word documents to other formats (DOT, PDF, etc.) Run with CScript.exe. Tested in Windows 7 with MS-Office 2010 installed.
alert = function(s) { WScript.Echo(s) }
var fso,
folder,
wordDoc,
wordApp,
extension = 'DOT',
fileFormat = 1, //see http://msdn.microsoft.com/en-us/library/office/ff839952.aspx
sourcePath = "\\SOURCE\\PATH\\" + extension + "\\",
destPath = "\\DESTINATION\\PATH\\";
Public Function getURL(rng As Range) As String
If rng(1).Hyperlinks.Count Then getURL = rng.Hyperlinks(1).Address
End Function
@shabdar
shabdar / bulk_file_renamer.vb
Last active July 10, 2019 13:03
Excel VBA code to copy and rename a number of files, based on the data on an Excel sheet.
Sub batch_rename()
On Error GoTo errHndl
Dim fso As New FileSystemObject
Dim fld As Folder
Dim sourcePath As String, destPath As String
Dim sourceFile As String, destFile As String, sourceExtension As String
Dim rng As Range, cell As Range, row As Range
sourcePath = "\path to old files\"
@shabdar
shabdar / missing_files.vbs
Created September 18, 2012 22:30
Finds and lists the missing files in a destination folder compared to the ones in a source folder with sub-solders. (Windows PowerShell Script)
'set paths
sourcePath = "\\source\"
destPath = "\\dest\"
'initiate the file system object
set fso = CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(sourcePath) then
'first get all the sub-folder
set folder = fso.GetFolder(sourcePath)