Hello everyone
Is it possible to access from any location the .csv file and read it with Script Runner on Cloud?
Yes, you can write code for SR that can reach out to other accessible sites and read data from them.
How are you publishing your CSV? Is it available on a proper URL, or are you looking at non-canonical UNCs like file shares?
Thank you @Nic Brough -Adaptavist- for the reply,
I am not limited of the location of the file, I just want to successfully accessing it.
First I thought to be attached on an issue (attachment), but I couldn't find how to access from there on Cloud, so I put the file on Google Sheets, and tried this code:
import com.opencsv.CSVReader;
@GRAPES(@grab(group='com.opencsv', module='opencsv', version='5.7.0'))
def filePath = 'urlFromGoogleSheetsFile'def reader = new CSVReader(new FileReader(new File(filePath)))def data= reader.collect { it }.with { rows ->def header = rows.head()def dataRows = rows.tail()
dataRows.collect { row ->[header, row].transpose().collectEntries()}}
data.each{row->// access any data from the row by the name of the header// for example, row['colHeader'] or row.colHeader}
..........
But I got this type of exception:
Ah, ok, reading the file, not a problem with getting it.
SR for Cloud doesn't import extra libraries like that - you'd need to get us (Adaptavist) to add it to the server running your scripts.
Have a look at https://library.adaptavist.com/entity/bulk-update-the-value-of-a-custom-field-on-jira-issues - that tells you how to read a remote file, but you're going to have to write code to parse it.
I checked the link, but it shows me how to update the value of a Custom Field on Jira Issue.
Also the idea is to reach some csv file through SR on Cloud, no matter on which location is, so it can read what is inside the file and do some stuff inside Jira?
It looks like you're new here. Sign in or register to get started.