# I want to update my data base with a dowload file csv

**URL:** https://community.glideapps.com/t/i-want-to-update-my-data-base-with-a-dowload-file-csv/66481
**Category:** Ask for Help
**Created:** [September 24, 2023, 1:50pm UTC](https://community.glideapps.com/t/i-want-to-update-my-data-base-with-a-dowload-file-csv/66481 "2023-09-24T13:50:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![theo\_180280](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/theo_180280/32/50049_2.png) [@theo\_180280](https://community.glideapps.com/u/theo_180280)
#### Post date: [September 24, 2023, 1:50pm UTC](https://community.glideapps.com/t/i-want-to-update-my-data-base-with-a-dowload-file-csv/66481/1 "2023-09-24T13:50:51Z")

</div>

hi, i want to update my data base(google sheet) with dowload a file csv direcly on my application.before i try with integromat but know i don t remenber.

---

<div class="post-metadata">

### Author: ![Dreamskills\_Academy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dreamskills_academy/32/62226_2.png) [@Dreamskills\_Academy](https://community.glideapps.com/u/Dreamskills_Academy)
#### Post date: [September 24, 2023, 4:40pm UTC](https://community.glideapps.com/t/i-want-to-update-my-data-base-with-a-dowload-file-csv/66481/2 "2023-09-24T16:40:36Z")

</div>

Hey, we used app script for that. And it works perfectly. We just upload xlsx file to our app, then in a minute all database is updated. If you want the script, just reply.

---

<div class="post-metadata">

### Author: ![theo\_180280](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/theo_180280/32/50049_2.png) [@theo\_180280](https://community.glideapps.com/u/theo_180280)
#### Post date: [September 25, 2023, 11:52am UTC](https://community.glideapps.com/t/i-want-to-update-my-data-base-with-a-dowload-file-csv/66481/3 "2023-09-25T11:52:46Z")

</div>

hi, thanks you yes i want the script thanks

---

<div class="post-metadata">

### Author: ![Dreamskills\_Academy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dreamskills_academy/32/62226_2.png) [@Dreamskills\_Academy](https://community.glideapps.com/u/Dreamskills_Academy)
#### Post date: [October 5, 2023, 10:04am UTC](https://community.glideapps.com/t/i-want-to-update-my-data-base-with-a-dowload-file-csv/66481/4 "2023-10-05T10:04:27Z")

</div>

Hi, Theo,

function onCellValueChange(e) {  
var range = e.range;  
var sheet = range.getSheet();  
var row = range.getRow();  
var column = range.getColumn();

if (sheet.getName() === “Sheet1” && row === 2 && column === 1) {  
updateGoogleSheetFromExcel();  
}  
}

function updateGoogleSheetFromExcel() {  
// Get the URL of the Excel file from a cell in Google Sheets  
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();  
var excelFileURL = sheet.getRange(“A2”).getValue(); // Update the cell reference as per your requirement

// Fetch the Excel file  
var fileBlob = UrlFetchApp.fetch(excelFileURL).getBlob();

// Convert the Excel file to a temporary Google Sheets file  
var tempFile = Drive.Files.insert(  
{ title: “TempFile”, mimeType: “application/vnd.google-apps.spreadsheet” },  
fileBlob  
);  
var tempFileId = tempFile.id;  
var tempSpreadsheet = SpreadsheetApp.openById(tempFileId);

// Clear the existing data in the destination Google Sheet  
var destinationSheet = SpreadsheetApp.openById(“1oBvxb6cFoeJX5AY5Ack57GUY3nUFlwYstNayiR3Js3f”).getActiveSheet();  
destinationSheet.clearContents(); // Clears all the data

// Get the data from the temporary Google Sheets file  
var tempSheet = tempSpreadsheet.getSheets()[0];  
var sheetData = tempSheet.getDataRange().getValues();

// Write the parsed data to the destination Google Sheet  
var numRows = sheetData.length;  
var numCols = sheetData[0].length;  
destinationSheet.getRange(1, 1, numRows, numCols).setValues(sheetData);

// Delete the temporary Google Sheets file  
Drive.Files.remove(tempFileId);  
}

пн, 25 сент. 2023 г. в 18:02, theo 180280 via Glide Community \<[notifications@glideapps.discoursemail.com](mailto:notifications@glideapps.discoursemail.com)\>:
