0

I am able to add a new sheet to an already exisiting Google Spreadsheet via the Sheets API using the code below. How do I import from a CSV to this new sheet ?

//Auth code to sheets API above this line
SheetsService sheetsService = new SheetsService(bc_init);
                string spreadsheetID = "XXXXXX";
                string sheetName = DateTime.Now.ToString();

                var addSheetRequest = new AddSheetRequest();
                addSheetRequest.Properties = new SheetProperties();
                addSheetRequest.Properties.Title = sheetName;

                BatchUpdateSpreadsheetRequest batchUpdateSpreadsheetRequest = new BatchUpdateSpreadsheetRequest();
                batchUpdateSpreadsheetRequest.Requests = new List<Request>();
                batchUpdateSpreadsheetRequest.Requests.Add(new Request
                {
                    AddSheet = addSheetRequest

                });
                var batchUpdateRequest = sheetsService.Spreadsheets.BatchUpdate(batchUpdateSpreadsheetRequest, spreadsheetID);
                batchUpdateRequest.Execute();
Nemo
  • 33
  • 7
  • This was answered [here](http://stackoverflow.com/questions/26854563/how-to-automatically-import-data-from-uploaded-csv-or-xls-file-into-google-sheet) – ReyAnthonyRenacia Apr 15 '17 at 10:13
  • I am looking accomplish this via .Net\C#. I already have the code to upload CSV to Google Spreadsheet using the drive api but that creates a new spreadsheet. I need to be able to upload the CSV to a new sheet of an exisitng Google Spreadsheet. – Nemo Apr 15 '17 at 17:20

0 Answers0