Posts

Showing posts with the label google-drive-sdk

Create folder and Upload file to Google Drive from TypeScript cannot compile

Image
Clash Royale CLAN TAG #URR8PPP Create folder and Upload file to Google Drive from TypeScript cannot compile I'm trying to create a folder in Google Drive from node.js, I found an example here that also shows how to upload a file into the new folder. I use TypeScript and my code looks like this: getAuthorizedClient().then((client) => { const drive = new drive_v3.Drive({ auth: client }); const folderMetadata = { 'name': `Order_${order.key}`, 'mimeType': 'application/vnd.google-apps.folder' }; drive.files.create({ resource: folderMetadata, fields: 'id' }) .then((folder) => { console.log('Created folder Id: ', folder.id); }) .catch(err => console.error(err)) }) .catch((error) => console.error(error)); When building the code, I get the following error: src/assets-handler.ts:110:5 - error TS2345: Argument of type '{ resource: { 'name': string; 'mimeType': string; }; fields: string;...

How to automatically import data from uploaded CSV or XLS file into Google Sheets

Image
Clash Royale CLAN TAG #URR8PPP How to automatically import data from uploaded CSV or XLS file into Google Sheets I have a legacy database system (not web accessible) on a server which generates CSV or XLS reports to a Google Drive folder. Currently, I am manually opening those files in Drive web interface and converting them to Google Sheets. I would rather this be automatic so that I can create jobs that append/transform and graph the data in other sheets. Is it possible to output a native .gsheet file? Or is there a way to convert CSV or XLS to .gsheet programmatically after saving it to Google Drive either in Google Apps or via a Windows based script/utility? google-spreadsheet-api can import data into an existing google spreadsheet. I suspect Drive API has a way to import as a new spreadsheet file, as I think I saw some code for the import on SO. – eddyparkinson Nov 11 '14 at 4:33 ...