Import data from a non public CSV into Google Sheets - google-apps-script

I have a list of customer names i would like to import into my spreadsheet from a CSV file. Preferably every hour.
The IMPORTDATA function works fantastic for this kind of operation.
The problem is that i don't want to store a CSV file with peoples names publicly. What would be your best suggestion to importing a CSV file to Google sheets without storing it on a publicly accessible URL? As i understand it there's no way to get Google Sheets to work via FTP?

You could store it in your own Google Drive.
From there you could handle the import with Apps Script instead of import range

Related

How to stop Google Drive from automatically saving csv's imported into a Google Sheets document

I often make spreadsheets in Google Sheets by importing a collection of csv files. But whenever I import a csv file into a Google Sheets document, the csv file is uploaded to my Google Drive as well.
As a result, I have a huge number of csv files in my Google Drive that I don't want.
Can I stop this from happening? I want to import the csv into the Google Sheets document but I don't also need the csv file in my Google Drive.
A follow-up question is: if I can't prevent the csv from being uploaded to my drive, can I delete the csv from my drive without affecting the Google Sheets document?
This question is related to this one How to stop Google Sheets automatically saving downloaded CSV files to Google Drive, but they asked the question incorrectly, and never followed up with a corrected question.
The CSV files being uploaded to the Google Drive is necessary. It is due to the fact that Google Sheets will only look for the source files to be imported either from your personal Google Drive or from other people's Google Drive that are shared with you.
Suggestion
As for your issue on multiple csv files, you can create a script to automatically delete csv files from your Google Drive. However, the only available feature in Google Apps Script is to move the said files to a folder using the File.moveTo(destination) function since the removeFile(child) function was already deprecated. Afterwards, you may use the setTrashed(trashed) function to send the files to the trash folder.
References:
You may view the following links for further details on how to apply the suggestion.
removeFile(child)
moveTo(destination)
setTrashed(trashed)
Google Apps Script Deleting Google Drive Files in Folder Example

How can I import data into google sheets when the URL is formatted as data:text/csv;base64

I am trying to import data into a google sheet by using the =IMPORTDATA("URL") function from this website https://public.domo.com/embed/pages/dPRol However the CSV file link is formatted as a data URL as such
data:text/csv;base64,RXZlbnRSZXNpZGVudENvdW50eSxJbmRpdmlkdWFscyBUZXN0ZWQsSW5kaXZpZHVhbHMgUG9zaXRpdmUsVG90YWwgUmVjb3ZlcmVkLFRvdGFsIERlYXRocw0KUG9sayw4MTA4Niw5NDc5LDY1NjQsMjAxDQpMaW5uLDMxMjg5LDIwMDUsMTU3Miw4Nw0KSm9obnNvbiwyMzMyOSwxODgxLDEzNjMsMTUNCkJsYWNrIEhhd2ssMjMyODQsMjk3MCwyMjQ2LDYyDQpTY290dCwyMjk
The import function in sheets does not seem to recognize the URL in this format. Would there be another way to import in this data.
The object of this is to create a source that auto updates when the data is updated. Perhaps there would be another solution other than google sheets.

Update CSV to Google Sheet's

I am trying to import about a 15,000 row csv file to a google sheet that we use.
I thought the import csv would work but i can figure out how to write it to make it work.
any help would be great.
to clarify i am trying to get a raspberry pi to update it via python.
upload your csv file in google drive. right click on csv file and select open with google sheets. it will load your csv data in google sheet and you can also download as xlsx in google sheets

Using/Calling Google Sheet's embedded File Import function in google apps script

Is there any way to call Google Sheet's File import function in Apps Script? I'm trying to import a csv file from a google drive folder to a google sheet. But I want to be able to set up an automated trigger to import a csv file with the same name regularly from the same google drive folder.
I'm aware that I can write an import function myself. And I actually wrote such function based on someone else's code I found on github. But the import function I have is very slow since it contains loops. Plus, parsing the entire csv file using the script is very slow. So I only want to use Google Sheet's embedded import function. -> I tried it and it's way faster than import a file using my script.
The menu commands are only available via the user interface. From a script, you can convert CSV files to Google Sheets format using Advanced Drive Service. First, enable the service (v2 of the API) as described on the page. Then in the Apps Script, proceed as follows:
var fileId = '0B.......jQ'; // Id of the CSV file
var newFile = Drive.Files.copy({title: 'Converted File'}, fileId, {convert: true});
var newFileId = newFile.id;
Now you have a converted file in your Google Drive (with the name 'Converted File'), and the variable newFileId contains the Id by which you can access this file using the methods of SpreadsheetApp. In particular, you can get its contents and put them elsewhere.

Google apps script : script to import xlsx file in google drive

I usually use google cloud connect. wondering if I have spreadsheet always sync with my updated xlsx automatically. It's look like import button in spreadsheet or upload button in google drive, I think. How do apps script do this case?
we all expect to have a "convertToGDocsFormat" member in File's DocsList API. (Actually, we expect the makeCopy member to have an option to convert it in the copy process.)
But DocsList API is experimental and perhaps incomplete, it doesn't have such method yet.
For now you can't convert a file to Google format from a script.
There is another (long) way to read data from a xlsx. Supposed you have the xlsx file sync'ed. You can access it using the experimental DocsList API, and get a blob.
XLSX file is a ZIP file you can unzip with Utilities.unzip not documented method that gives you an un zipped blob.
Then you have to navigate the tree folder (in the blob) to get the XML files you want to read (from the blob). This tree folder and its XML files describe the entire XLSX spreadsheet.
Finally you may parse such XML file and navigate trough it and get cells' values.
This is not quick to code, nor to execute.